disable browser back button

how to disable browser back button that works for all major browsers: IE/FF/ Chrome/Opera/Safari.


Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

It is not possible to disable the browser back button. There are couple of work arounds:

  1. Open your website in a window without the toolbar so back button is not visible. But this will not enable any shortcut key (like backspace) for the back button.
  2. Another work around is to use AJAX to update your DOM always so that back button is never enabled.

Solution 2

It’s is technically impossible to disable the back button, but maybe this will help you out. It shows you some ‘tricks’ to achieve the same functionality.

But you can also use AJAX and load everything asynchronous (so the user will always be on the same single page)

Solution 3

Use history.forward(); in your source page from where you are going to the target page.now if u try to go back to the previous page u can’t.

<script type="text/javascript" language="javascript">

disabling the browser button is not possible but try this solution if u want to implement in the same way.

Solution 4

You can try below script which is working code, put this code on your web page(.aspx).

<script type="text/javascript">

    function noBack() { window.history.forward(); }
    window.onload = noBack;
    window.onpageshow = function(evt) { if (evt.persisted) noBack(); }
    window.onunload = function() { void (0); }


Happy coding !!

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply