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?
The basic idea behind it is the following: The browser requests some content from the web server. If the content is not in the browser cache then it is retrieved directly from the web server. If the content was previously cached, the browser bypasses the server and loads the content directly from its cache.
To ensure you see the latest version of a site you need to clear the cache memory. This is done by doing a force refresh by pressing both control and F5 buttons simultaneously on your keyboard (depending on your browser). Most times a simple force cache refresh won't work and you need to clear the cache by hand.
In general, most modern browsers will cache JavaScript files. This is standard practice for modern browsers and ensures an optimized loading experience. Cached assets such as JavaScript will typically be served from the browser's cache instead of making another request for a resource that has already been retrieved.
Browser caching is a process that involves the temporary storage of resources in web browsers. A visitor's web browser downloads various website resources and stores them in the local drive. These include images, HTML files, and JavaScript files.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With