I have a bunch of HTML static files. I realize chrome doesn't really obey the rules in my HTML static file.
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
Seems to be bug? http://code.google.com/p/chromium/issues/detail?id=28035
I do not know any workaround. Anyone knows?
Configure your web server to send these as headers for your file (or all *.html files).
Since you didn't specify your web server, can't really give more info.
Related
I have this Web site: https://fascinatingdreams.com/fd1/index.html. I have set cache behavior to no caching in the meta tags, in the head section of the HTML files of the site, but the site fails to respect those caching directives, and the HTML files load from the cache. Developer tools show that the headers have cache-control: max-age=0.
What I want to achieve is that the HTML pages will not load from the cache.
This is the HTML code that I use to prevent caching of the Web pages:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
Thank you for your answers in advance.
I have the following code on my (all html webpages) :
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
However, this is not clearing up caches and my code updates are not showing up. Is there another way to accomplish cache refresh?
It is better to use standard HTTP headers to control the caching from the server side, rather than using the http-equiv meta tags in your HTML. It allows for controlling proxy caching and other intermediaries, making it a lot more effective. The meta tags also don't help if you have external CSS and JS files. These will still be cached, which may explain why it isn't working correctly for you. You would have to append a randomly generated query string to your resource paths so that the browser appears to be loading a brand new resource every time.
The http-equiv values above are actually not in the HTML 5 specification, so are not valid. You can read more on using HTTP headers correctly in this useful caching guide.
When I regenerate the documentation with doxygen (1.8.7) and upload it to the webserver, I always get re-served the same pages as before the upload.
I've tried Ctrl-F5 (FireFox), I've also tried putting the following meta in src/header.html and recompiling doxygen:
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="-1">
I've also tried using the .htaccess file to control the cache. Unfortunately, I always get served stale html pages.
What am I missing to totally deactivate the cache for doxygen generated html?
I generally work with WordPress but just completed a project for a client that was a static HTML page consisting of 8 pages and ~2 images per page. Working with WordPress I would either use w3 total cachce, cloudflare, photon or a solution through wp engine.
I've been doing research and found a few solutions regarding meta tags, and manipulating an .htaccess file. The meta tag route, I read, is not a reasonable solution as it does not validate properly with HTML5. (this was specifically referring to setting up no cache, but same idea)
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
Reference here: Using <meta> tags to turn off caching in all browsers?
I also read a little bit here:
http://www.metatags.info/meta_http_equiv_cache_control
Using something like this:
<meta http-equiv="Cache-control" content="public">
<meta http-equiv="Cache-control" content="private">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache-control" content="no-store">
But I'm not sure how they actually work and which is the correct one. Can someone point me in the right direction? Thanks!
Step away from the <meta> tags. Default caching headers sent by the web server are, in most cases, already appropriate for a static web site. Unless you have some unusual requirements - which does not appear to be the case here - there should be no need to modify them.
I have a page with another html page in iframe. In this iframe, i put this header tag
<META http-equiv="Pragma" content="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<meta http-equiv="cache-control" content="no-cache" />
But chrome still cache it, when iframe content changed, hit f5 button but chrome still load cached version, not new version.
Please tell me how to pevent google chrome cache this iframe.
Set the correct expiry headers in the HTTP response from your server. They override anything you've put in meta tags.
This works in Chrome:
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
I found this in a Chromium bug.
https://bugs.chromium.org/p/chromium/issues/detail?id=28035
Meta tags can be ignored. Instead of them your server should set appropriate HTTP headers for cache control. You should also set the Expired header.
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Avoiding_caching
I found that Chrome may ignore those meta settings in the file in favor of the cache settings in http response header. I was able to fix this issue in IIS by adding this in my web.config
<system.webServer>
<staticContent>
<clientCache cacheControlMode="NoControl" />
Files still get cached but now I can explicitly exclude a file if I need to.