Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

This question already has an answer here:

I have a two JavaScript (.js) files in a static resource. When I enter the full URL of a JavaScript file in the browser, https://uknow.cs14.my.salesforce.com/resource/1301087741200/VExpander/easyXDM.packed.js the JavaScript file is displaying whereas if I do https://uknow.cs14.my.salesforce.com/resource/1301087741200/VExpander/VExpander.child.js the JavaScript file is not displaying.

FYI, both of the JavaScript files are in the same static resource. I have updated the VExpander.child.js file. Prior to my update, VExpander.child.js was displaying in the browser.

Is there a reason for not displaying the file?

share|improve this question

marked as duplicate by DavidSchach, ca_peterson, Samuel De Rycke, Bachovski, regal Apr 12 at 12:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
can't think of any other reason than either a typo or the file not being present in the zip that you uploaded as static resource.. –  guy Apr 11 at 14:02
    
@guy I could see the file in the static resource –  sf.dev Apr 11 at 14:07
    
I was afraid you were going to say that :-) I found something in the docs, posting an answer now.. –  guy Apr 11 at 14:09

2 Answers 2

The number 1301087741200 is a timestamp corresponding to a version of the static resource. If you are using $Resource.VExpander in Visualforce it will automatically output the number of the latest version of the static resource. But if you hard code the number you will still be getting an earlier version of the zip file.

share|improve this answer
    
I think $Resource.VExpander can be used in Visualforce page.But I need it javascript –  sf.dev Apr 11 at 14:31
    
All the cross-linking URLs should be relative not absolute and all the referenced files should be in the same zip. That avoids needing the static resource path. But if for some reason you can't achieve that, setup a configuration JavaScript object in your Visualforce page (that can use $Resource, $Page etc) and have your separate JavaScript files depend on that object. –  Keith C Apr 11 at 14:49

Excerpt from the documentation on http://wiki.developerforce.com/page/Delivering_Static_Resources_with_Visualforce

Sometimes developers are tempted to just hard-code the resulting URL (eg: /resource/1235794002000/stylesheet_red) into their Visualforce pages, but when you do this as opposed to using the $Resource.stylesheet_red expression, you are hard-coding the timestamp. In development you may not notice a problem, but in live production, if you ever updated a resource's file, the new version wouldn't start getting served up for around 24 hours or so. So if you were fixing a bug in a JavaScript file for example, you would have to wait a day for the file to become stale in the cache servers until a new copy was pushed out. In other words, never hard-code URLs!

share|improve this answer
    
How to reference static resource (js file present in static resource) in javascript –  sf.dev Apr 11 at 14:29
    
See @Keith's response and another hack here: jevonearth.blogspot.nl/2011/08/… but maybe better to put a new Question on stackexchange to get more attention. –  guy Apr 11 at 14:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.