While browsing the code of some websites I sometimes notice that some JavaScript files are included like this:
<script type="text/javascript" src="javascripts/jquery.js?1252521516"></script>
But I don't see what the jquery.js ?1252521516 part of the src parameter does. Can anyone explain this to me please?
It allows websites to force browsers to update their cached version of a script or other resource.
For example, when the Javascript code on that website changes, the number at the end would be changed. The browser would see as a totally new file, meaning it would not use whatever outdated, cached version it had previously downloaded. This gives you all the benefits of caching with the ability to bypass the cached version at any time.
It's known as a cache breaker. It stops the browser using an old version of your javascript due to caching rules.
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