How can I change the back button function in navigation toolbar?

Posted by jackrobert on Stack Overflow See other posts from Stack Overflow or by jackrobert
Published on 2010-04-13T05:22:54Z Indexed on 2010/04/16 7:03 UTC
Read the original article Hit count: 297

Filed under:
|

I have developed a simple web application using JSP. It has a login page which contains username, password fields and sumbit button. It has a logout page which contains a link to the login page. And there are some pages like page1, page2, page3, page4, etc.

Normal workflow is the following:

  • After login comes page1.
  • Then click some action and it will go to page2.
  • Then click some action and it will go to page3.
  • Then click some action and it will go to page4. So now I am in page4.
  • Now click back button in navigation toolbar in browser, generally go to previous page (page3).

But my requirement is, if you click back button in navigation toolbar from any page in the application, then you should go to logout page. For example: if you are in page4 and press the back button, then you should go to logout page and not to page3.

How to achieve this? Is it anyway possible? Maybe with Javascript?

© Stack Overflow or respective owner

Related posts about jsp

Related posts about JavaScript