Last updated on January 23rd, 2023 at 05:51 pm

Hello webmasters, I am going to share with you a quick tutorial on how to disable browser back button, this will work fine in Mozilla, IE , chrome and all other famous browsers. There are multiple ways to disable browser back button using Javascript.

With the use of a simple javascript we can force the webpage to go forward once the back button is being triggered. This script will be very powerful when combined with database operations where a web developer doesn’t want users to use back button in browser.

For example when a Bank Transaction has taken place in the previous page.

This one works with Mozilla Firefox

<body onUnload="noBack()">
function noBack()

You can also use the below script, but i have noticed that it wont work in some browsers especially Mozilla v 3.5


Above scripts may not be compatible with all browsers.

This script works on Chrome and Firefox

<script type = "text/javascript" > 
history.pushState(null, null, location.href); 
window.onpopstate = function () { history.go(1); };

history.pushState() : Adds an entry to the browser’s history
history.back() : Make browser to move back one page
history.forward() : Make browser to move forward one page

More details on history interface can be found here


Leave a Reply

Your email address will not be published. Required fields are marked *