For like the last 5-6 years I have designed all my web projects so all front-end resources like javascript files are fetched as little as possible from the server
So I have used expires
headers on the webserver with 1 year expire. On the front-end I have added the version in the query string like this
<script src="my_js_file.js?v=323"></script>
But recently I have experienced that Goole Chrome has become more strict about it, so you have to clear the browser cache to update your javascript files if you don't change the version in the query string like ?v=4939
. But sometimes it looks like it doesn't always update the cache anymore even if the version is added by one
Is this a bug in chrome or a new "feature" to make the internet "faster"? If it is, this is a shit feature which doesn't let you control your versions of a website anymore
This is not a problem for me while developing the site but for the users of the website.. The cache is not updated when a new version is released
Since some browsers doesn't acknowledge changing query string as a new file, do like this instead
<script src="my_js_file.3.2.3.js"></script>
Edit
Google suggest: you do this by embedding a fingerprint of the file, or a version number, in its filename—for example, style.x234dff.css.
Here are a couple of posts that might be useful, with some more explanations/sample/guides:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With