Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

I have added HTTP headers for not storing the pages in cache. This code is done on server side in Java Servlet. The same works on IE but in firefox web pages are still cached. How can we stop caching from server side for firefox?

  • 4 个回答
  • 14 人有此问题
  • 7 次查看
  • 最后回复者为 todd_buell

more options

I have added HTTP headers for not storing the pages in cache. This code is done on server side in Java Servlet. The same works on IE but in firefox web pages are still cached. How can we stop caching from server side for firefox?

Below is the sample code writter in Java Servlet which does not allow the back button of the browser to navigate in Internet Explorer. But in Firefox this code will fail and back button will work.


response.setHeader("Cache-Control", "no-cache");//HTTP 1.1 response.setHeader("Pragma", "no-cache");//HTTP 1.0 response.setHeader("Expires", "0");//prevents caching at the proxy server response.setHeader("Cache-Control","no-store");


I have added HTTP headers for not storing the pages in cache. This code is done on server side in Java Servlet. The same works on IE but in firefox web pages are still cached. How can we stop caching from server side for firefox? Below is the sample code writter in Java Servlet which does not allow the back button of the browser to navigate in Internet Explorer. But in Firefox this code will fail and back button will work. ------------------------------------------ response.setHeader("Cache-Control", "no-cache");//HTTP 1.1 response.setHeader("Pragma", "no-cache");//HTTP 1.0 response.setHeader("Expires", "0");//prevents caching at the proxy server response.setHeader("Cache-Control","no-store"); ---------------------------------------------

所有回复 (4)

more options

Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
http://forums.mozillazine.org/viewforum.php?f=25
You'll need to register and login to be able to post in that forum.

more options
more options

Hi thanks for reply I have already added this

response.setHeader("Cache-Control", "no-cache");//HTTP 1.1 response.setHeader("Pragma", "no-cache");//HTTP 1.0 response.setHeader("Expires", "0");//prevents caching at the proxy server response.setHeader("Cache-Control","no-store");

in http response header at java servlet side. But its not goving any effect in firefox.I have used firefox version 3.5.2

more options

Be mindful that Java's HttpServletResponse objects setHeader overwrites the old value of the header while addHeader will allow the headers to have multiple values, which is what you want.