无法禁用 jsp 缓存
我不希望浏览器缓存指定的jsp,所以我在我的jsp中使用了下面的代码:
<%
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
%>
但是,它不起作用。每次我按后退按钮时,浏览器都会显示缓存的页面而不刷新。
jsp中代码的位置重要吗?如何禁用缓存?
I don't want the browser to cache a specified jsp, so I used the code below in my jsp:
<%
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
%>
However, it doesn't work. Everytime I press the back button, the browser shows the cached page without refreshing.
Does the position of the code in the jsp matter? How to disable the cache?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
拼写错误?
Pramga
而不是 Pragma?尝试。编辑:看到这个问题 How to control web page跨所有浏览器缓存?
A typo?
Pramga
instead of Pragma? Try.EDIT: see this question How to control web page caching, across all browsers?