Click to See Complete Forum and Search --> : Disable "Go Back" button
Hi everyone
Is anyone know how to disable the "go back" button in browser.
Or when the user click the "go back" button, it will remain at default page .
Need ASAP
Thx
:o Mac :)
compuGEEK
Jun 19th, 2000, 10:37 PM
You can't disable the Back button on a browser,
but you could open a new window without menu's or navigation using javascript.
HarryW
Jun 20th, 2000, 08:18 AM
It depends on how sure you want to be that the user can't get back really, because there's some simple solutions but they might not be satisfactory. One way is to open the page in a new window and close the old one (not sure but I expect you can do that in JavaScript - I've only done server side programming). Or you can send the user to a page which immediately redirects them to the page you want them to see, ie use 'response.redirect("your_page_here")' as the first and only line in the intermediate page. That way as soon as the user clicks the back button, they'll get redirected to where you want them.
If it doesn't matter too much then you could just show a message asking the user to use a link (which you have provided) to the page they want to go back to instead of clicking back. I favour this method myself, as I find it very annoying when websites have restrictions like that in place.
If the reason this is a problem is because of variables getting messed up, then maybe you could make them session variables or store them in a cookie or something.
You can't properly disable the back button...no browser's allow you to do that. Opening a new window with no toolbar is one possibility, but you can often use ALT+LEFTARROW to go back. You can't open a new window and automatically close the old one (unless the old one was created using javasctipt). Tis some security thingy built into javascript.
Best bet is to either use a redirecting page so when the user clicks back they get the redirect page that sends them forward again. Problem with this is that IE & Netscape give you the option to jump back more than one page at a time (bypassing your redirect page).
The other option is to have all your pages generated at runtime (with asp or something similar) and give each page a unique id number...if a user requests a page with an id number that has already been used then deny the request. This would also disable the refresh button too. Problem with this: when IE is in "Offline Browsing" mode it will happily go back to a server generated script page from its cache...without re-requesting it. :(
Conclusion: it can't be done...not completely...there's always a way to go back. Sorry.
On second thoughts...I take my last statement above back:
You could always write your own browser!! :D
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.