• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javascript

 
challa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anyone solve this requirement?
When the user clicks logout from his account and then clicks back button in the browser to access his account, he should be notified to login again.

How to solve this using javascript/html?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens whne you click the Back button is up to the browser - most of them will just re-display the previous page, and not load the URL again. If you want to prevent that, you can POST the logout request. In that case the browser should notify the user that the page will actually be retrieved from the server, at which point you can redirect to the login page.
Using JS you could mess around with the local cache -I think it's called window.history or something similar- and prevent the user from going back.
[ August 18, 2005: Message edited by: Ulf Dittmer ]
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd just set the headers for every page to not cache.

This is what I do in Servlets/JSP:

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

-Yuriy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic