disable browser back button – disable back button in browser using javascript?

disable browser back button – How to disable browser back button with JavaScript,Code to disable browser back button on particular page with javascript, disable back button with javascript.

disable browser back button

disable back button in browser using javascript – To disable web browsers’ back button, try to run the following code.

stop the browser back button Example

window.onbeforeunload = function() { return "sorry, Your some work will be lost - really sorry."; };

How to disable the browser back button using JavaScript?

Example 1:

<script type="text/javascript">
        function disableBack() { window.history.forward(); }
        setTimeout("disableBack()", 0);
        window.onunload = function () { null };
</script>

Don’t Miss : How to disable browser back button using JavaScript?

Read Also:  Delete Table Rows Using PHP JQuery Ajax

How to Disable Browser Back Button using JavaScript?

Example : 2

window.history.pushState(null, null, window.location.href);
window.onpopstate = function () {
window.history.go(1);
};

Disable browser back button using JavaScript

Example : 3

<script type = "text/javascript" >  
    function preventBack() { window.history.forward(); }  
    setTimeout("preventBack()", 0);  
    window.onunload = function () { null };  
</script>

Disable Browser Back Button Functionality using JavaScript

index Page(index.html)


<script type="text/javascript">
        function preventBack() { window.history.forward(); }
        setTimeout("preventBack()", 0);
        window.onunload = function () { null };
    </script>
<h3>index</h3>

<hr />

<a href="dashboard.html">Redirect to dashboard</a>


Dashboard Page (dashboard.html)

<h3>Dashboard</h3>

<hr />

<a href="index.htm">Redirect to index</a>


I hope you get an idea about disable back button in browser using javascript.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.