Capture Back button

Discussions

Web tier: servlets, JSP, Web frameworks: Capture Back button

  1. Capture Back button (3 messages)

    I require this functionality wherein when the user clicks on the back button of the browser, the session is invalidated and an error page is shown. This should also happen when the user clicks on refresh.
      I have seen some banking sites wherein this kind of functionality is implemented. Can anybody tell how could that be implemented?
    A quick solution would be appreciated.

    Threaded Messages (3)

  2. Capture Back button[ Go to top ]

    I require this functionality wherein when the user clicks on the back button of the browser, the session is invalidated and an error page is shown. This should also happen when the user clicks on refresh.  I have seen some banking sites wherein this kind of functionality is implemented. Can anybody tell how could that be implemented?A quick solution would be appreciated.
    This is a horrible UI, why do you want to do that? I mean, showing error on going back is OK, but why invalidate the session?
  3. Capture Back button[ Go to top ]

    I know the requirement is weird, forget the session invalidation requirement. How can we show an error page on click of Back or refresh button?
  4. Capture Back button[ Go to top ]

    I know the requirement is weird, forget the session invalidation requirement. How can we show an error page on click of Back or refresh button?
    To show error on back you need to mark the page that you are returning to as non-cachable, "no-cache, no-store" works for most browsers. In this case browser will reload a page again, and you can return an error instead of stale page. But this does not work for Opera, it does not reload stale pages on Back, even ones marked as non-cachable.

    Showing error on Reload is a bad UI, I don't know why would you do that. But same idea works here too: verify either application state or a request "token" and return a different page.