我如何防止Firefox缓存 [英] how can i prevent firefox caching

查看:90
本文介绍了我如何防止Firefox缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了很多可能的解决方案,但我无法解决问题:

i tried a lot of possible solutions but i can't solve the problem:

<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache-control" content="no-store">
<meta http-equiv="Cache-control" content="must-revalidate">
<meta http-equiv="pragma" content="no-cache"> 
<meta name="expires" content="0">

这些不起作用.有人可以帮忙吗?我正在使用jsp/servlet.应用程序是Websphere Portal 6.1的Portlet.

these are not working. Can anybody help? I am using jsp/servlet. And application is a portlet for websphere portal 6.1.

推荐答案

从不依赖HTML页面中的元标记来控制缓存.相反,您需要在响应中设置HTTP标头.在显示任何输出之前,在您的控制器中,您需要设置以下内容:

Never rely on meta tags in an HTML page to control caching. Instead you need to set the HTTP headers in your response. In your controller before you display any output you will want to set the following:

response.setHeader("Cache-Control", "max-age=0, must-revalidate");

这过去对我有用,但如果不起作用,您可能还想尝试以下方法

This has worked for me in the past but you may also like to try the following if that doesn't do the trick

response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 1);

这篇关于我如何防止Firefox缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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