I am developing a site, but every time I do a small change I have to perform a hard refresh in order to see the change.
The开发者_Go百科 obvious question here is that a user probably will never do a hard refresh, and so he/she will not see the effects immediately. Plus, sometimes when I change the stylesheet, without hard refresh the site looks like a mess.
What can I do?
You can force the page not to cache by adding cache control meta tags:
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
You can also prevent caching of your stylesheet by adding a version get parameter:
<link rel="stylesheet" href="mystyles.css?v=1" type="text/css" />
Increment the version number to force a new version to be loaded.
So, the changes in your design (external stylesheets?) are not immediately showing?
This probably has to do with the browser cache. Your files are cached, which is a good thing. If you want to invalidate the cache, you might add a parameter to your external files, like this:
<link rel="stylesheet" type="text/css" href="http://sstatic.net/stackoverflow/all.css**?v=f023310c4326**">
The developers of this awesome piece of software know all about this.
精彩评论