4

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

jatin_ghataliya
  • 144
  • 1
  • 1
  • 16
bhavesh N
  • 787
  • 3
  • 9
  • 27

3 Answers3

1
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();">
Piyush Chaudhari
  • 962
  • 3
  • 19
  • 41
0

you need to set the response header in the focusing page, (i.e) in the login page. ensure the following code in the login.jsp page,

Coding:

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

/* Note: place this code above any of those code */

but i don't know wheather the same functionality can be done using javascript/jquery,"awww... i don't think so!!!"

Maran Manisekar
  • 821
  • 1
  • 8
  • 9
0

Generate code that uses one of the techniques defined here.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242