I've noticed that many websites has a GET
parameter attached to their js
and css
files. So files become something like: path/to/my.css?v=49
or path/to/my.js?v=1.4
.
I did some research and I understood that it used for files caching so the browser won't download the files again every request. I've tried to understand how exactly it works but honestly, I have no idea.
I've seen some posts that says that you tell the browser to download the new file every few minutes, but I was thinking it can be a little bit tricky because if I push a major change (or even a critical bug fix) and the user it trying to access the website but his browser is still using the cached file he won't be able to access it even tho the bug was fixed. He will have to wait until his browser will pull the new file from the server instead of using the cached version. (Obviously I assume that the user does not know when the bug fix will be pushed, when the browser will pull the new files or how to manually pull the new files without waiting for the browser.)
I would like to read about that caching method and how I can overcome the issue I mentioned above.