How to disable browser back button using JavaScript?

How to disable browser back button using JavaScript?

 

In this article, how to disable browser back button using JavaScript?

 

Using window.history.forward()

 

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

2021-10-03