A site I get on allot has updated a few of their files, and I wanted to know the meaning of them. For example, their CSS, and majority of their images. Before their update, the file was called "default.css" or "navigation.png". Now with their new updates, their files and images have this ?v at the end of them with a number, such as "default.css?v2" or "navigation.png?v3". Can anybody explain to me what does this mean?
closed as off topic by Charles Boyung, JonW♦ Jan 3 at 8:41
Questions on User Experience Stack Exchange are expected to relate to user experience within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.
its a method of versioning the otherwise stored static files. Essentially browsers can store various files / filetypes locally for any amount of time as it is dictated by the enduser. The purpose of adding / appending these values is to juke said cache without creating a file nightmare on the server.
thats at least my assumption in this situation.
additionally, the reason this invalidates the static cache or gets around it is that they are requesting a file first and then also attempting to pass a query string to it. The query string creates a new context for the file and thus, a prior stored version is not conjured up from enduser cache but instead forces a server download.
It's a short way to invalidate cache or caching proxies, without actually changing any filenames.
For static files and unless some specific processing is taking place, you can usually rather safely add a question mark, "?", followed by any arbitrary string.
The web-server that has these static files will ignore everything after and including "?", but the web-developer can usually ensure that fresh copies of these files will be re-requested by the client (e.g. web-browser or caching-proxy), instead of possibly the old and incompatible cached versions being used, since caching is almost always done only on the complete URLs with all the HTTP GET params, which include "?" etc.
Note that the explicit approach you've described, with adding just a "?v2", only works if you always go forward on the web-server, and always in atomic steps. If you ever downgrade back to v1 whilst a v2 page requests a v2 document, or have a partial upgrade from v1 to v2, then a v1 (or v2) document will be served as if it was a v2 (or v1), since the web-servers generally don't do anything with these "?v1" / "?v2" markings on static files.