I have updated a static resource with a new file and kept the reference (using url not $Resource) the same. The updated resource was not loaded, even when I left it over the weekend. Even deleting the static resource has kept the resource in the community cache for some reason.

This seems like a bug, but is there also a way to refresh the cache in the pointer to static resources for community?

  • Did you try force reload? (CTRL + F5). Usually I use a guest window in chrome to test cache issues with static resource. Also using $Resource.StaticResourceName is a best practice.
    – Raul
    Sep 17, 2018 at 13:01
  • I've tried force resetting the browser and testing on different computer as well. I'm fully aware of the $Resource method, but I'm just wondering if there is a way to pull the latest version so I don't have to change the code and push change sets.
    – rna7
    Sep 17, 2018 at 15:18

1 Answer 1


If I follow you correctly, you're saying that you're directly including a static resource in a community with a url like /resources/my_resource_png instead of using the preferred format of {!URLFOR($Resource.my_resource_png)}.

One reason to prefer the second is that it generates the actual URL based on the last modified time of the resource. So it renders as something like /resource/1535031348000/my_resource_png. Part of the reason for that is so that browsers know not to use the cached version if the last modified version has changed - uploading a new version of the resource changes the URL.

The fact that you get the same version is not a bug in SF, in fact it's nothing to do with SF, it's all about the browser.

If you really cannot use the {!URLFOR($Resource.my_resource_png)}, you can always just throw your own version number on the end of an explicit reference e.g. /resources/my_resource_png?v2. I would strongly encourage you to use $Resource, though,


Questioner has clarified that they'd using Lightning. In Lightning, you refer to the resource like this:

<ltng:require scripts="{!$Resource.my_resource_png}"

That has the same effect as what I described above for Visualforce.

  • I'm using <ltng:require> for loading the scripts from static resource like <ltng:require styles="/resource/leaflet/leaflet.css" scripts="/resource/leaflet/leaflet.js" afterScriptsLoaded="{!c.jsLoaded}"/>
    – rna7
    Sep 17, 2018 at 15:17
  • OK, thanks, I've updated my question. That does show why it's useful to share your code in the question!
    – Aidan
    Sep 18, 2018 at 9:01
  • I'm fully aware of using scripts="{!$Resource.my_resource_png}", I'm just wondering if there is a way to refresh the cache or get the latest version automatically without having to change every reference to the static resource that uses scripts="/resource/my_resource.png". Particularly in Communities it doesn't refresh.
    – rna7
    Sep 18, 2018 at 9:09
  • But why would you use scripts="/resource/my_resource.png" in the first place? It's just the wrong way to reference a resource, so unless you actually have to do it that way, the best answer is just to switch all your resources over to the right way. Other solutions, like the hard-refresh of the browser above, aren't feasible for a live community because you can't ask all your users to do that
    – Aidan
    Sep 18, 2018 at 9:23
  • 1
    It's legacy code and would just be easier than changing every reference. That is all.
    – rna7
    Sep 18, 2018 at 11:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .