是否有一个<元>?标签来关闭所有浏览器中的缓存?元>
我读到,当您无法访问 Web 服务器的标头时,您可以使用以下命令关闭缓存:
<meta http-equiv="Cache-Control" content="no-store" />
但我还读到,这在某些版本的 IE 中不起作用。是否有任何
集合?将关闭所有浏览器中的缓存的标签?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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
对于现代网络浏览器(IE9 之后)
请参阅页面顶部列出的重复项以获取正确信息!
请参阅此处的答案: 如何跨所有浏览器控制网页缓存?
对于IE9及之前版本
请勿盲目复制粘贴!
实际上根本不要使用这些!
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?
For IE9 and before
Do not blindly copy paste this!
Actually do not use these at all!
根据独立安全评估者的伟大 全行业对缓存控制的误解案例研究,只有
Cache-Control: no-store
被Chrome、Firefox和IE识别。 IE 可以识别其他控件,但 Chrome 和 Firefox 不能。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.它在 IE5 中不起作用,但这不是一个大问题。
然而,缓存 headers 在元元素中是不可靠的;其一,网站和用户之间的任何网络代理都将完全忽略它们。您应该始终对 Cache-Control 和 Pragma 等标头使用真实的 HTTP 标头。
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.
pragma 是你最好的选择:
pragma is your best bet:
当重复相同的服务调用(长轮询)时,我注意到服务调用存在一些缓存问题。添加元数据没有帮助。一种解决方案是传递
时间戳
以确保ie
认为这是不同的http
服务请求。这对我有用,因此添加服务器端脚本代码片段来自动更新此标签不会有什么坏处: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 ensureie
thinks it's a differenthttp
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">
尝试使用
Try using