[英]How to expire webpage when back/forward from browser button
I want to implement following features to my one of the website project; 我想为我的网站项目之一实现以下功能;
I am already setting no-cache through meta tag 我已经通过meta标签设置了no-cache
Please let me know how to implement above features. 请让我知道如何实现上述功能。
http://www.mnot.net/cache_docs/ http://www.mnot.net/cache_docs/
This HTTP header: 此HTTP标头:
Cache-Control: public, no-cache
缓存控制:公共,无缓存
Take a look at that document! 看看那个文件!
You can place HTTP headers with instructions about how the browser should cache the page. 您可以放置HTTP标头,其中包含有关浏览器应如何缓存页面的说明。
cheers. 干杯。
Killing the session must be enough. 终止会话必须足够。 When you go back, refresh the page and the user is logged in again, there must be some sort of automatic relogin.
当您返回时,刷新页面,然后用户再次登录,必须进行某种自动重新登录。 This is mostly done using a cookie when the user chooses to check the "remember me" option.
当用户选择检查“记住我”选项时,多数情况下是使用Cookie来完成的。
I would suggest the following: 我建议以下内容:
See if there is a cookie and some sort of re-login mechanism. 查看是否有cookie和某种重新登录机制。 If so, try to logout, clear the cookie, use the back button and see if the problem still exists.
如果是这样,请尝试注销,清除cookie,使用“后退”按钮,查看问题是否仍然存在。 This way, you know the relogin logic kicks in.
这样,您就知道了重新登录逻辑。
If there is no cookie or the above test failed, check the code where you test the session. 如果没有cookie或以上测试失败,请检查用于测试会话的代码。 Maybe you creating it accidentally.
也许是您意外创建的。 For example, when you get the session from an http request, you can control if a new session should be created:
例如,当您从http请求中获取会话时,可以控制是否应创建新会话:
eg 例如
request.getSession(false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.