Disable back button when exiting jsp

I have a jsp page and the problem is that when I click the exit button, it redirects to the login page, but when I click the back button, it displays the previous pages, so how can I handle it.

+4
source share
3 answers

Create code that uses one of the methods defined here .

0
source
if you handle session manually in your application than you remove all session variable from your application and put the following java script in your page logout page <SCRIPT type="text/javascript"> window.history.forward(); function noBack() { window.history.forward(); } </SCRIPT> </HEAD> <BODY onload="noBack();" onpageshow="if (event.persisted) noBack();"> 
+1
source

you need to set the response header on the focus page (ie) on the login page. check the following code on login.jsp page,

Coding:

 response.setHeader("Cache-Control","no-cache"); response.setHeader("Pragma","no-cache"); 

/ * Note: put this code above any of these codes * /

but I don’t know that the same functionality can be done using javascript / jquery, "awww ... I don’t think so !!!"

0
source

Source: https://habr.com/ru/post/1346512/


All Articles