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

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

问题描述

我在这个页面上有这个代码:

i have this code here on a page:

<!-- 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.是元标记属性http-equiv值在所有浏览器的html中仍支持cache-control?因为当我在w3school登记时,属性http-equiv没有值缓存控制,编译指示和过期。

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

推荐答案

< ; meta http-equiv> 标签仅在从非HTTP资源(如本地磁盘文件系统)打开相关HTML文件时使用(通过 file:// URI)而不是从真实HTTP资源打开有问题的HTML文件时(通过 http:// 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.

所以,你的导致具体问题的原因是< meta http-equiv> 标签被忽略

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

  • How to control web page caching, across all browsers?
  • Avoid back button on JSF web application

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

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