是否有< meta>标签以关闭所有浏览器中的缓存? [英] Is there a <meta> tag to turn off caching in all browsers?

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

问题描述

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

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

但是我也读到这在某些版本的IE中不起作用.是否有任何< meta>组?标签会关闭所有浏览器中的缓存?

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?

推荐答案

用于现代Web浏览器(在IE9之后)

有关正确信息,请参见页面顶部列出的重复项!

在此处查看答案:如何在所有浏览器中控制网页缓存?

该列表仅是不同技术的示例,并非直接用于插入.如果复制,第二个将覆盖第一个和由于http-equiv,第四个将覆盖第三个声明,并且W3C验证程序失败.最多只能有一个每个http-equiv声明之一;编译指示,缓存控制和到期.当使用现代的最新浏览器时,这些已经完全过时了.反正IE9之后.Chrome和Firefox根本无法像您期望的那样与它们一起使用.

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

实际上根本不使用这些!

高速缓存标头在meta元素中不可靠;一个,网站和用户之间的任何Web代理都将完全忽略他们.您应该始终对标题使用真实的HTTP标头,例如缓存控制和语用.

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.

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

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