I have a quite troublesome issue which I didn't find a good solution for yet.
I allow caching of all my application static files (JS, CSS and images) by browser for performance.
Problem is, when I'm doing upgrades, the users still use the old version from their cache, which often breaks the application, and requires clearing the cache every time to solve the problem.
Is there any good multi-browser approach which still allows caching the files, but can force to reload them when needed?
Thanks for any info.
When you're in Google Chrome, click on View, then select Developer, then Developer Tools. Alternatively, you can right click on a page in Chrome, then click Inspect. Click on the Network tab, then check the box to Disable cache. You can then close out of Developer Tools.
The Cache-Control header This header prevents all caching of a particular Web resource when the no-cache value is specified by an HTTP 1.1 server. Pages that are kept out of the cache aren't accessible until the browser can recontact the Web server. So, servers should use the Cache-Control header sparingly.
Caching is an incredibly useful feature that works by temporarily storing data closer to the user. By distributing shared page elements such as Javascript, CSS, and images this way, a website can attain a host of benefits – all of which positively impact the underlying business.
In computing, a cache is a high-speed data storage layer which stores a subset of data, typically transient in nature, so that future requests for that data are served up faster than is possible by accessing the data's primary storage location.
Append somethign to the URL as parameter, e.g. myresource.css?version=1
. The file will be servered correctly, that's a trick to force reloading the cache. You only need to generate the html page dynamically.
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