File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript" Watch "javascript" New topic
Author

javascript

challa
Greenhorn

Joined: Mar 28, 2005
Posts: 23
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
Marshal

Joined: Mar 22, 2005
Posts: 39544
    
  27
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 ]

Ping & DNS - updated with new look and Ping home screen widget
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript
 
Similar Threads
Question related to banking project?
Automaticaly capitalising text using Javascript
Base64 Encoding
get the ActionForm property value into a java variable from JSP
how to retrieve init params from portlet.xml???