简体   繁体   English

单击浏览器的后退按钮后如何避免后退?

[英]How to avoid to go back after click on back button of browser?

I am using jsp and jquery. 我正在使用jsp和jquery。

After logging in, the home page is displayed, but when I click on the back button of browser, it show me log in page again. 登录后会显示主页,但是当我单击浏览器的后退按钮时,它会再次显示登录页面。

When I click on the back button, I want it to redirect to the home page, like GMail does. 当我单击后退按钮时,我希望它像GMail一样重定向到主页。

Simply check if someone is logged in at the login page, and if so redirect to the homepage. 只需检查是否有人在登录页面上登录,然后登录到主页即可。 No magic necessary here. 这里没有魔术。

It is a good practice to check whether a user is login or not in login page. 最好在登录页面中检查用户是否已登录。 If user is login then redirect him/her to your desired page, otherwise login him. 如果用户已登录,则将其重定向到您所需的页面,否则将其登录。

Go to this link, it is properly explained there. 转到此链接,那里有正确的解释。

http://www.bajb.net/2010/02/browser-back-button-detection/ http://www.bajb.net/2010/02/browser-back-button-detection/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM