sha*_*han 5 java jsp caching meta-tags
我正在使用以下代码.
<%
response.addHeader("Cache-Control","no-cache");
response.addHeader("Pragma","no-cache,no-store,private,must-revalidate,max-stale=0,post-check=0,pre-check=0 ");
response.addDateHeader ("Expires", 0);
%>
Run Code Online (Sandbox Code Playgroud)
它在IE中完美运行,但页面仍然在Firefox中缓存.我想在Firefox中停止缓存.有什么建议?
Bal*_*usC 10
你很困惑Cache-Control
和Pragma
标题.交换它们.Firefox也需要no-store
和must-revalidate
沿着no-cache
.
response.addHeader("Cache-Control", "no-cache,no-store,private,must-revalidate,max-stale=0,post-check=0,pre-check=0");
response.addHeader("Pragma", "no-cache");
response.addDateHeader ("Expires", 0);
Run Code Online (Sandbox Code Playgroud)
更重要的是,只有它no-cache,no-store,must-revalidate
足以Cache-Control
让它跨浏览器工作.
与具体问题无关,我建议将这段代码放在Filter
您映射的类中,*.jsp
而不是在您要禁用浏览器缓存的所有JSP文件上复制相同的代码.
归档时间: |
|
查看次数: |
3915 次 |
最近记录: |