问题
When aggressively caching CSS and other files, you can force the user to update to the latest version of the stylesheet by renaming the file and linking to the new copy (eg, style.123.css renamed to style.124.css). A different method often used instead of renaming the file is to pass a URL parameter, (eg, style.css?ver=123 which is later changed to style.css?ver=124).
Do all browsers support the latter method for downloading a new copy of the stylesheet? Are there any disadvantages to using the URL parameter over renaming the file?
回答1:
After further research, it turns out that some proxy caching services will not cache files with query strings in the URL. Whether this is true for some web browsers, I don't know.
So this seems to be the only major disadvantage of using query strings to update aggressively cached files - they may not cache at all.
回答2:
The only way a browser could not "support" query-parameter controlled caching is if the browser used the cached version retrieved using a different parameter value. I have never heard of a browser that did that. So yes, all browsers support this technique. The only disadvantage I can think of is that you can't host multiple versions of the resource simultaneously. (assuming you are using static files)
来源:https://stackoverflow.com/questions/14744149/aggressive-caching-do-all-browsers-support-url-parameter-for-updating