Disable Back Browser Button in web Page
This example will show how to disable Back button in your browser. To achieve this objective, the javascript will be use to redirect back to the current page if the user click on the browser back button and give message to user. So let see the example. I'll set the script at HEAD element and use onpageshow and onload event in the body element. The Javascript put in Head element <script type="text/javascript"> window.history.forward(); function noBack() { window.history.forward(); document.getElementById("Message").innerHTML = "You cannot Go Back"; } </script> The Html/Aspx/Jsp page : : Head element : <body onpageshow="if (event.persisted) noBack();" onload="noBack();" > : : body content <div id="Message" style="color:red;"> </div> : : </body> </html> The Output If the user click on the browser back button, the script will automatically redirect to