How to avoid user viewing the previous pages?


XML & Web services: How to avoid user viewing the previous pages?

  1. How to avoid user viewing the previous pages? (7 messages)

    Hi all

    In my application, the user can make update in some pages and I want to avoid the user going back to the update page after the update has succeed. I have seen that some website can display a "Warning Page has been expired" on the browser when I try to go to the previous page. Can anyone please how to achieve it?

    Thank you !!

    From Edmond
  2. Stick this in your JSP page:

    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
  3. You could use a workflow-aware framework for your application.

    JStateMachine ( is a good open source application framework that will help you deploy code on the server to ensure the flow you want is followed properly.

    Setting expires and no-cache headings depends upon the browser behaving as it should...
  4. Setting expires and no-cache headings depends upon the >>browser behaving as it should...

    So, how does it achieve it? Because the data is on the browser how can you prevent user pressing the "Backspace" which will go to the previous page in IE.
  5. You cannot prevent the user from pressing backspace or the back button.

    What you can do is detect when the user has gone backwards and do something about it.
  6. Edmond,

    As Ferhart said, it makes it possible to detect when the user has used the back button and handle it easily.

    For example: you could configure the workflow such that if an event arrived out of sequence the user would be brought to a page telling them that the back button shoud not be used, and given the option of starting the process again or continuing from where they left off.

  7. Use POST for navigation. When a page is returned as a result of a form POST submission, browsers will refuse to display it unless the original data is re-posted, and will prompt the user with a 'page has expired' message if they hit the 'back' button.
  8. This does not work in all cases[ Go to top ]


    We have included the code for page expiry, however we observe that it works in some cases and it does not work in some cases. Also is this code browser dependent.

    Your feedback is highly apprecited.