Why do some websites access certain versions of a CSS or JavaScript file using GET options?

I have seen quite a few websites that do this (even stackoverflow itself) in my created HTML source, accessing a specific version of a CSS or JavaScript file with GET parameters. What is the point?

Example:

<link rel="stylesheet" href="http://sstatic.net/so/all.css?v=6230"> <script type="text/javascript" src="http://sstatic.net/so/js/master.js?v=6180"></script> 

Is it just a way of consistency or best practice? Are customers with older cached versions simply forced to update their legacy version in their browsers?

+6
javascript html css
source share
4 answers

Is it just that customers with older cached versions in their browsers are forced to update the obsolete version?

That's right.

Check out this question for more information, further links and discussions, and this question is about how the stack method itself uses the method.

+4
source share

Yes, this is for breaking the browser and proxy caches. There is no other purpose.

Well, theoretically you can dynamically generate javascript, and then you need these parameters. For example, JSONP works. But basically this is for invalid caches.

+1
source share

To get the browser to get the new version, and not just use the cached older version. What is it.

0
source share

This is used with an expiration date for CSS / Javascript. This allows the site to inform your browser about data caching for a very long time (for example, 5 years). When css or js is updated, the version number will be changed, which will lead to cache failure.

Browsers cache css / js on the full query string.

0
source share

All Articles