function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dan_GruDan_Gru 

Problem with using static resources

Hello, i was trying to include static resources on my page with tags <apex:includeScript> and <apex:stylesheet>.

 

I used URLFOR to map the right path to resources.

So i wrote code:

<apex:includeScript value="{!URLFOR($Resource.all_res, '/js/json2.js')}" />

and like this.

 

As a result script wasn't included, and in the firebug debug window wrote this text:

 

"Failed to load source for: https://c.na7.visual.force.com/resource/1279700783000/all_res/js/json2.js"

 

I looked to "https://c.na7.visual.force.com/resource/1279700783000/all_res" in browser and it is really my static resource. After that i looks to "https://c.na7.visual.force.com/resource/1279700783000/all_res/js/json2.js" and find an empty page there. How it possible? Where i miss? And how can i include my recources?

krishnagkrishnag

try giving this command

 

<apex:includeScript value="{!URLFOR($Resource.all_res, 'js/json2.js')}" />

Dan_GruDan_Gru

If you mean try without "/" in inner path to resources - I tried it. Nothing change.

aballardaballard

Did you produce the resource file on a mac?  Many people have found that the default way of creating a zip file on a mac seems to add a root directory with the same name as the zipped folder.   So the path would be

{!URLFOR($Resource.all_res, '/all_res//js/json2.js')}

 

(Assuming your  source folder was originally all_res )

Dan_GruDan_Gru

No, i created package in windows.

 

Five minutes ago i have returned to this problem and without any ideas to make right solution create package again. And it works 0_o. Probably i miss somewhere when did it last time. Thanks to all who was trying to help. Topic might be closed.

Sebastian Gnagnarella 1Sebastian Gnagnarella 1
Try not zipping the root folder (that contains your JS  files) but the files themselves.