How to disable Back button in IE and firefox? [duplicate]


I have to disable back and forward button of browser ( IE and Firefox both ). I have tried:

//disable back button
window.onbeforeunload= function() { }   

but this works only in IE.
Is there any foolproof solution?



The answer is "no". You cannot disable a browser's back button.

Or at least on a good browser.


I believe this question has already been asked:

Disabling Back button on the browser Prevent Use of the Back Button (in IE)

If you're trying to prevent the user from losing their work, try something like:

window.onbeforeunload = function() { return "You work will be lost."; };



There is no solution for that problem. You can't really "disable" it.


I would argue you should not disable the back button it at all possible as users are used to using it and it will frustrate them to find its functionality removed.

The users flow will be interrupted and they will leave your site.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.