does that help with caching or something? i.e. if you change to <link rel="stylesheet" href="css/theme.css?v=1.1">;
the browser would download the new version?
I have long used the method of adding the date to my stylesheet name (e.g. style170118.css), which serves the same purpose and also lets me see at a glance when it was last updated.
It’s something I would like to see a definitive answer for. I’m aware that adding a version parameter to things like css is something a few people do, but does it stop caching altogether, even if the parameter/value doesn’t change?
Searching around It’s hard to find recent and definitive information on this.
The first article I came across seems clear that for a resource to be cached you should not use variables, but put the version in the filename. But that is nearly 10 years old, and that’s exactly what I was attempting to avoid with my above code: having to manually rename my css every time I edit it, then also change the name in the link to it in the html head. The way I have been doing it I don’t even need to think about versioning, I just FTP the file and the server does the donkey work.
But the information in that article appears to be corroborated by GTmetrix:-
#PageSpeed: Remove query strings from static resources Overview
Most proxies, most notably Squid up through version 3.0, do not cache resources with a “?” in their URL even if a Cache-control: public header is present in the response. To enable proxy caching for these resources, remove query strings from references to static resources, and instead encode the parameters into the file names themselves.
Then I found another, relatively recent article, which makes reference to the previous one, giving an update that the default behaviour of Squid (which was the issue identified) was no longer the case and it would now cache URLs with variables.
It may be something worth looking into and testing so we know what the facts are today.