• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javascript

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic