0

For website used js file resources, even I modify the js files it still cached on the some user's pc, then it will make problem cause the new code depends on modification on the new js file rather the old js file.

How to check this!? while when I used my pc it give me no problem such like other users

Hana90
  • 943
  • 5
  • 17
  • 37
  • 1
    Look up "cache busting", how precisely you do that will depend on the tools you're using. – jonrsharpe May 14 '17 at 09:21
  • Possible duplicate of [How to force browser to reload cached CSS/JS files?](http://stackoverflow.com/questions/118884/how-to-force-browser-to-reload-cached-css-js-files) – Leonid Vasilev May 15 '17 at 11:03

1 Answers1

1

You have to append a dynamic value to your JS-source like this:

<script src="/path/to/your.js?v=2"></script>

Notice the ?v=2, if you increase this value every time you change your JS-file, the users will always have the updated version.

This new version will stay cached until you change the parameter again.

ad_on_is
  • 1,500
  • 15
  • 27
  • What do you mean by that? Each time you increase the `v=` the browser of your users will load the new JS-file. – ad_on_is May 16 '17 at 19:17