3

When I change something in production environment I always increase the "minutes" by 1 in the timestamp, e.g.:

<script src="js/some_javascriptfile.js?version=202008141500"></script>

=>

<script src="js/some_javascriptfile.js?version=202008141501"></script>

1 month ago I applied a change to the codebase, but today I noticed an issue in the backend, which (as far as i know) couldn't have happened with the latest javascript code.

My question is: could be that one of the browsers ignored my datetimestamp change and on loading the page used the old code?

In our company we are using IE11, Edge (MS based or Google based) and Chrome. Nothing else is allowed.

Or is there any option in some browser which tells "use cached version of the .js file even if the timestamp was changed" ?

user3719454
  • 994
  • 1
  • 9
  • 24
  • 1
    Are you sure it is not the html page itself which is cached? – TiiJ7 Aug 14 '20 at 14:07
  • 1
    Yes, it's possible that the timestamp is ignored. Some older versions of IE did it, I believe, I don't know if it persists in IE11. They'd take off the query string from the resource and just ask for the base resource or fetch if from cache if it's found there. And yes, it was an issue. Cache busting via timastamping is a very old technique anyway, you should be instead sending the caching headers to determine how long the browsers cache things and when to flush that cache. I'm pretty sure all modern browsers, including IE11, support that. – VLAZ Aug 14 '20 at 14:07
  • @TiiJ7 HTML is never cached. – Asutosh Aug 14 '20 at 14:08
  • @TiiJ7 I use this for .html: `` `` `` – user3719454 Aug 14 '20 at 14:11

1 Answers1

0

This is related to Cache busting via params If the timestamp has changed browser (you have mentioned) will not at all cached the JS, it will serve the file from the server.

Asutosh
  • 1,775
  • 2
  • 15
  • 22