是否不支持元 http-equiv 值缓存控制? [英] is meta http-equiv value cache control is not supported?

查看:24
本文介绍了是否不支持元 http-equiv 值缓存控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上有此代码:

<!-- no cache headers -->
<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" />
<!-- end no cache headers -->

当我转到其他页面并点击浏览器的返回按钮(返回到编写此代码的页面)时,它仍然具有页面的缓存状态.选项是添加 PhaseListener 但他们告诉我添加 PhaseListener 是要维护的附加代码.
问题是:
1.所有浏览器的html中仍然支持元标记属性http-equiv值缓存控制吗??因为当我签入 w3school 时,属性 http-equiv 没有值 cache-control、pragma 和 expires.
2. 如果我添加 phaseListener 对在每个页面中添加元标记有什么好处.?
提前致谢

when i go to other page and hit back button of browser (back to the page where this code written), it is still had the cache state of the page. option is, to add PhaseListener but they told me that adding PhaseListener is an additional codes to maintain.
The question is:
1. is meta tag attribute http-equiv value cache-control is still supported in html in all browser?? because when i check in w3school, there is no value cache-control, pragma, and expires for attribute http-equiv.
2. if i add phaseListener what would be the advantage against adding meta tags in every page.?
Thanks ahead

推荐答案

标签仅在有问题的 HTML 文件从非 HTTP 文件打开时使用资源,例如本地磁盘文件系统(通过 file:// URI),而不是从真正的 HTTP 资源(通过 http:// URI)打开有问题的 HTML 文件时> URI).相反,使用了通过 HttpServletResponse#setHeader() 设置的真实 HTTP 响应标头.

The <meta http-equiv> tags are only used when the HTML file in question is been opened from a non-HTTP resource such as local disk file system (via file:// URI) and not when the HTML file in question is been opened from a real HTTP resource (via http:// URI). Instead, the real HTTP response headers as set via HttpServletResponse#setHeader() are been used.

因此,您的具体问题是由于那些 标签被忽略造成的.

So, your concrete problem is caused because those <meta http-equiv> tags are ignored.

这篇关于是否不支持元 http-equiv 值缓存控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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