![]() |
|
|
Published: Wednesday, November 15, 2000 By Akhilesh Reddy
In Part 1 we examined a few potential ways to disable the back button, a commonly asked question on the ASPMessageboard. In this part we'll continue our examination of various techniques for preventing the user to return to the previous page!
My next area of research focused on the various rewiring the back button suggestions. An article by TJ Sylvester, Rewiring the Back Button, makes interesting reading but I noticed that when one clicks back it does not indeed take you to the page you entered the data but if I clicked back twice it does and we would not want that too. Basically a determined user could always figure out a way to circumvent the preventative measures. Another way to "disable the back button" is to use client-side JavaScript code to open a new window that doesn't have the toolbar. (This makes it harder (not impossible) for the user to go back to the previous page.) Another, more failsafe approach (although quite annoying) is, when a form is submitted, to open a new window and close the window that the form existed in. I didn't give this method serious thought because I would not like my site opening up a new window everytime a user submitted a form. Next I examined the possibility of adding client-side JavaScript code on the page that we do not want to let the user return to. Such JavaScript code could be used to have the effect of hitting the forward button, which would counter any action by a user clicking the back button. The JavaScript code to accomplish this can be seen below:
Again this is workable but it is far from the best way.
I was then given the suggestion to use For one thing you will have to use client side script for this. For an anchor tag this will be easy by just using:
The above technique has its disadvantages: simply using After my exhaustive search I found that there is still no way of truly disabling the back button for all cases. All the methods I discussed in this article will, with varying degrees of success, prevent the user from viewing the previous page, but they, of course, all have their limitations. The best solution involves a mixture of both client-side and server-side script; regardless, there is no way to completely disable the back button... sorry!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|