in reply to How To Disable A Browser's Back Button in CGI.pm?

Thanks to everyone who dissuaded me from the Javascript no-back-button solution.

It turned out that there was a coding error which only showed up when the user hit the back button. My script stores a CGI.pm query object on Page 2 and then retrieves and deletes it on Page 3.

However, users who hit the back button on Page 3 to return to the form on Page 2 and then resubmitted got an error, because some of the CGI variables stored in the CGI query object no longer existed.

The proper solution turned out to be to check that a stored query object exists, and provide the user with a helpful warning message if it does not. The advantage of this approach is that the browser's back button still works the same way as it always does, and the user knows what is going on.

  • Comment on Re: How To Disable A Browser's Back Button in CGI.pm?

Replies are listed 'Best First'.
Re: Re: How To Disable A Browser's Back Button in CGI.pm?
by Anonymous Monk on May 30, 2003 at 21:59 UTC
    Yes you effectively can, this works every time: <SCRIPT LANGUAGE="JavaScript"> //always go forward window.history.forward(1); </script>