Say I've got a web app. I add some features to it, and those features require additions to some existing CSS files on my web server. I deploy my new features and CSS additions to my server, and they work great. Users visiting the site will probably have cached CSS in their browser, though, which means the new features will look broken/weird until either they manually refresh the page or their cache expires. The problem might be even worse if there's a cache server between my server and the user, in which case even a manual refresh won't help (I don't think).
Is there a common way to avoid this?
EDIT: I'm running on ASP.NET 4.0.
If your site is not live yet, and you just want to update the stylesheet at your pleased intervals, then use this: Ctrl + F5 . On Mac OS (in Chrome) use: Cmd + Shift + R . This will force your browser to reload and refresh all the resources related to the website's page.
Anytime you make changes to CSS, JavaScript and are viewing the page you've updated - you will see this concern. You can force a refresh by pressing CTRL+F5 on the browser and that will get the latest version.
It works, all the time, for everyone. But, if you're not using it, and you just need to reload that one CSS or JS file occasionally in your own browser... just open it in its own tab and hit SHIFT-reload (or CTRL-F5)!
You can add an arbitrary name value pair to the end of your css request and it will act as if it's not cached. For instance:
<link media="all" href="myhomepage.css?sid=1" type="text/css" rel="stylesheet">
When you make a change change the sid value.
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