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

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.

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...
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.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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

read the last couple headers:  If you truly want to control history which the back button is tied to...
again:  another example:

and finally this solution sort of works, but it has its faults too...


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
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.

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.
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

From novice to tech pro — start learning today.