Disable Mouse Back button with javascript

Mouse Back Button: Question:
Hi all,

Have an application where I need to disable where back is used. I currently disable toolbars, disable right click and disable the backspace key, my mouse has 5 buttons and one of these goes back.

Is there a way to stop this from going back?  I have looked everywhere and can't seem to find a valid solution

Thanks,
John
PlacesForPeopleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

silemoneCommented:
you can't truly disable back button...you can make it where the page can't go backwards though...the only true way to disable this is to open a new window where there is no where to go back to...
0
bradl3yCommented:
I don't think there would be a valid way to do this 100% of the time. The back button is a feature of the browser that can not be disabled. It can be hidden, but many browsers also have other keyboard short cuts for the back button, and these days, most browsers will not allow you to disable right click.

But, there is a way that seems to work somewhat:

We will have PageA and PageB. PageA is simply a blank page that will immediatly redirect to PageB. PageB is your page with the actual content. When the user tries to go back, they go back to PageA, which in turn will immediatly redirect them back to pageB.

If your concerns for this deal with an AJAX application, you can use anchors to make the back and forward buttons function as you would expect. Every time something changes in the application, you need to "redirect" to the same page with an anchor at the end that represents the current state (url.com/index.php#tab_options). When a browser redirects to the same page with an anchor attached, most browsers will NOT reload the page, and all of the anchors used will show up in the back/forward history.
0
bradl3yCommented:
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

silemoneCommented:
the only way as stated is to either call page in new window...and close old


http://www.hunlock.com/blogs/Mastering_The_Back_Button_With_Javascript
0
silemoneCommented:
read the last couple headers:  If you truly want to control history which the back button is tied to...
0
silemoneCommented:
again:  another example:

http://www.irt.org/script/311.htm
0
silemoneCommented:
and finally this solution sort of works, but it has its faults too...

http://www.boutell.com/newfaq/creating/backbutton.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DJDecayCommented:
Impossible to completely disable the back button. Depends on the client (Browser) executing the code, and on the fact that Java Script is enabled and no proxy exists that will filter out the code.

Think of another way, unless you know that the client is IE 7 for example for internal use.

If you're writing merchant processing code, deal with form "repost" (duplicate order submission) on a transactional level (data layer and db), not on the client level.


0
PlacesForPeopleAuthor Commented:
Thanks for all of your comments.  I will look for a work around through some of the links you have sent through.

At the minute our browser is IE6 but will no doubt be IE7 by some time next year.  I didn't think there would a way to completely remove the back function but it looks like it isn't possible to completely control the events on an internet mouse.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.