Disable browser back button using javascript

<script type="text/javascript">
   
    function noBack() {
     window.location.href += "#";
     setTimeout("changeHashAgain()", "50");
    }

    function changeHashAgain() {
      window.location.href += "1";
    }
   
    var storedHash = window.location.hash;
    window.setInterval(function () {
        if (window.location.hash != storedHash) {
             window.location.hash = storedHash;
        }
    }, 50);
</script>

<body onLoad="noBack()">
</body>

Comments

Popular posts from this blog

Simple Invoice Creation With Jasper Report

Dynamic Image in Jasper Report

Auto Increment Oracle Table Id Mapping With JPA Entity