Is there a <meta> tag to turn off caching in all browsers?

HtmlInternet ExplorerFirefoxCachingasp.net Web-Api

Html Problem Overview


I read that when you don't have access to the web server's headers you can turn off the cache using:

<meta http-equiv="Cache-Control" content="no-store" />

But I also read that this doesn't work in some versions of IE. Are there any set of <meta> tags that will turn off cache in all browsers?

Html Solutions


Solution 1 - Html

#For modern web browsers (After IE9) ###See the Duplicate listed at the top of the page for correct information! See answer here: [How to control web page caching, across all browsers? ][1]


#For IE9 and before ###Do not blindly copy paste this!

> The list is just examples of different techniques, it's not for direct > insertion. If copied, the second would overwrite the first and the > fourth would overwrite the third because of the http-equiv > declarations AND fail with the W3C validator. At most, one could have > one of each http-equiv declarations; pragma, cache-control and > expires. These are completely outdated when using modern up to date browsers. > After IE9 anyway. Chrome and Firefox specifically does not work with these as you would expect, if at all.

<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" />

###Actually do not use these at all!

> Caching headers are unreliable in meta elements; for one, > any web proxies between the site and the user will completely ignore > them. You should always use a real HTTP header for headers such as > Cache-Control and Pragma.

[1]: https://stackoverflow.com/questions/49547/how-to-control-web-page-caching-across-all-browsers "How to control web page caching, across all browsers?"

Solution 2 - Html

According to Independent Security Evaluators' great case study on the industry-wide misunderstanding of controlling caches, only Cache-Control: no-store is recognized by Chrome, Firefox, and IE. IE recognizes other controls, but Chrome and Firefox do not.

Solution 3 - Html

It doesn't work in IE5, but that's not a big issue.

However, cacheing headers are unreliable in meta elements; for one, any web proxies between the site and the user will completely ignore them. You should always use a real HTTP header for headers such as Cache-Control and Pragma.

Solution 4 - Html

pragma is your best bet:

<meta http-equiv="Pragma" content="no-cache">

Solution 5 - Html

I noticed some caching issues with service calls when repeating the same service call (long polling). Adding metadata didn't help. One solution is to pass a timestamp to ensure ie thinks it's a different http service request. That worked for me, so adding a server side scripting code snippet to automatically update this tag wouldn't hurt:

<meta http-equiv="expires" content="timestamp">

Solution 6 - Html

Try using

    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionleeand00View Question on Stackoverflow
Solution 1 - Htmluser159088View Answer on Stackoverflow
Solution 2 - HtmlPaulView Answer on Stackoverflow
Solution 3 - HtmlbobinceView Answer on Stackoverflow
Solution 4 - HtmlKJ SaxenaView Answer on Stackoverflow
Solution 5 - Htmluser1496767View Answer on Stackoverflow
Solution 6 - HtmlorfView Answer on Stackoverflow