0

I have several web resources that are displayed on forms in Microsoft Dynamics. The web resources are html files that include JavaScript/CSS files. When I update the JavaScript files, I am seeing that the latest changes are not getting pulled to end user computers on their next use of the form. I believe this is because the previous version of the web resource has been cached on their machine.

According to this SO question, the solution would be to add a version to the script tag. However, according to the comments on the question, this solution does not work on Chrome and is considered a hack. I have also read here that Dynamics should automatically handle caching when web resources are updated, but does not do so reliably (which is my experience).

How can I force end user computers to get the latest version of my code on their next use of the form when I push out updates?

Tim Hutchison
  • 3,483
  • 9
  • 40
  • 76
  • 1
    Possible duplicate of [How can I force clients to refresh JavaScript files?](https://stackoverflow.com/questions/32414/how-can-i-force-clients-to-refresh-javascript-files) – dferenc Jan 08 '18 at 22:06
  • You're looking for a _cache buster_ (as seen in the link in the previous comment). – cbr Jan 08 '18 at 22:30

1 Answers1

0

If you are only changing the files for development (ie. Once they are finished they won't change), then most browsers will allow you to disable the cache. In Chrome, this can be done as long as developer tools are open and you click the "disable cache" button in the network tab. If they are going to change for the client with each request, then you can generate a random ID to be sent with the file (eg example.com/script.js?182hdh2). To allow this, just put some js in your html file (not in an external script) to import all the other files.

Tom Anderson
  • 440
  • 3
  • 10
  • Unfortunately, we will be updating the files with new versions somewhat frequently. We would still like to take advantage of caching as much as possible between updates. – Tim Hutchison Jan 09 '18 at 14:13