[SalesForce] Can’t access static resources in visualforce page

I have a visulaforce page in which I need to use some static resource. Here is the header of the VF :

<head>
        <meta charset="utf-8"/>
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <title>title</title>

        <meta name="viewport" content="width=device-width, initial-scale=1"/>

        <apex:stylesheet value="{!URLFOR($Resource.myZip, 'v4.css')}" />
        <apex:includeScript value="{!URLFOR($Resource.myZip, 'jquery.mask.min.js')}"/>
        <apex:includeScript value="{!URLFOR($Resource.myZip, 'jquery.min.js')}"/>
        <apex:includeScript value="{!URLFOR($Resource.myZip, 'v4.js')}"/>

    </head>

After that, in the body I have a classic html structure.

My poblem is that I can't access the static resource, neither the css or the javascript files are retrived. In the explorer of my browser, I got this kind of error :

GET https://myOrg-fr.cs83.force.com/resource/1528102717000/myZip/v4.js 404 not found

The static ressource is "public" and it is a zip folder (type application/x-zip-compressed)

Best Answer

This is a very common error and come if we didn't give correct path to the file. Make sure you have given correct path. Don't forgot to include any folder, Subfolder in your path name.

For eg: If these all files is in MyZip folder then you need to add that in path as well.

<apex:stylesheet value="{!URLFOR($Resource.myZip, 'myZip/v4.css')}" />
<apex:includeScript value="{!URLFOR($Resource.myZip, 'myZip/jquery.mask.min.js')}"/>
 <apex:includeScript value="{!URLFOR($Resource.myZip, 'myZip/jquery.min.js')}"/>
 <apex:includeScript value="{!URLFOR($Resource.myZip, 'myZip/v4.js')}"/>
Related Topic