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?

marked as duplicate by DavidSchach, ca_peterson, Samuel De Rycke, Boris Bachovski, Ashwani Apr 12 '14 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 '14 at 14:02
  • @guy I could see the file in the static resource – sfdc Apr 11 '14 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 '14 at 14:09

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.

  • I think $Resource.VExpander can be used in Visualforce page.But I need it javascript – sfdc Apr 11 '14 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 '14 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!

  • How to reference static resource (js file present in static resource) in javascript – sfdc Apr 11 '14 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 '14 at 14:59

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