In the head section of the sample html file from the html5boilerplate project, I notice this:
<link rel="stylesheet" href="css/style.css?v=2">
Note the v=2 request variables. I also notice that this is never done for javascript files.
What is the actual function of doing this ?
The
?v=2might be to prevent reading from cache by the browser. It’s used when loading dynamic content from a static file, like so:This forces the browser to use this exact file, not a cached version of
changingListOfStuff.txtpreviously downloaded and stored by the browser. Caching speeds up loading time, but might provide an older version of the file if it changes rapidly.Read more about caching here: http://en.wikipedia.org/wiki/Web_cache