File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes tracking  browser  back  button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "tracking  browser  back  button" Watch "tracking  browser  back  button" New topic

tracking browser back button

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Hi All,

how to track the browser back button at the time of user click the back button. i saw the website...when ever you click the back button ..they take you some page(let it be logout.jsp) messsage that session expire... even if you click the back button it redirect to the same page(logout.jsp)

how can acheive this?.. please can anyone tell me the idea?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Have you taken a look at the HTML/JavaScript that's used on that site?
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
You can generate an unique key for each page and keep it in session, which can be validated with each request. This unique key will match only once for a page, if it does not match show the appropriate error message to the user. Also no-cache can be used for pages, so that browser does not cache them.

My Blog
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Thanks Vinod and ULF
I agree. Here's the link:
subject: tracking browser back button
jQuery in Action, 3rd edition