Take the 2-minute tour ×

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?

share|improve this question
This question isn't asking about User Experience, but rather the technicality of file naming conventions. –  slawrence10 Jan 3 '13 at 1:25
add comment

closed as off topic by Charles Boyung, JonW Jan 3 '13 at 8:41


2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment
