使用< meta>标签在所有浏览器中关闭缓存? [英] Using <meta> tags to turn off caching in all browsers?

查看:304
本文介绍了使用< meta>标签在所有浏览器中关闭缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到,当您无法访问Web服务器的标题时,可以使用以下命令关闭缓存:

  < meta http-equiv =Cache-Controlcontent =no-store/> 

但是我也读过,这在某些版本的IE中不起作用。有没有一套< meta>标签会关闭所有浏览器的缓存?

解决方案

不要盲目复制粘贴!




这个列表只是不同技术的例子,不是直接插入
。如果被复制,第二个会覆盖第一个,
第四个会覆盖第三个,因为http-equiv
声明和W3C验证器失败。最多可以有
每个http-equiv声明中的一个;杂注,缓存控制和
过期。使用现代的最新浏览器时,这些都完全过时了。
反正IE9以后。 Chrome浏览器和火狐浏览器并没有像你期望的那样工作,如果有的话。




  < meta http-equiv =cache-controlcontent =max-age = 0/> 
< meta http-equiv =cache-controlcontent =no-cache/>
< meta http-equiv =expirescontent =0/>
< meta http-equiv =expirescontent =Tue,01 Jan 01 1:00:00 GMT/>
< meta http-equiv =pragmacontent =no-cache/>



其实不要用这些!



< blockquote>

元素中的缓存标题是不可靠的;一,
站点和用户之间的任何web代理将完全忽略
他们。您应该总是使用一个真正的HTTP标头,例如
Cache-Control和Pragma。



请参阅列出的Duplicate正确信息页面的顶部!


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?

解决方案

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.

See the Duplicate listed at the top of the page for correct information!

这篇关于使用&lt; meta&gt;标签在所有浏览器中关闭缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆