• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 - logout - prevent back button

 
francis varkey
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my struts2 application, I have a logout code. After logout I can't prevent browser back button. I am trying with following code

response.setHeader("Cache-Control","no-cache"); // HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0);

but its is not working.

Thanks
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use response.setHeader("Cache-Control", "no-store");
 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have tried the same but it didn't works, so i have use javascript to disable back button,
google and you will find a lots of javasript code to acheive the same.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens if Javascript is disabled on the client side web browser?

This should be better handled by the application if setting the response header does not work. You would anyways be clearing session data associated with the logged in user in the logout Action. Check for that and handle appropriately.

Cheers,
Raj.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic