How to Disable browser's back button Using Javascript




First of all, we strongly recommand not to disable Browser's back button. If you need, please inform the user before doing this. Below is the javascript code for disabling browser's back button.

Disable Browser's Back Button, How To Disable Browser Back Button, Back Button Disable, Asp.Net, Disable Browser's Back Button Using Javascript, Disable Browser's Back Button Using Jquery, Window.History.Forward, Window.Onunload, Window.Onbeforeunload, Window.Location.Hash, HTML, PHP, Jquery, Javascript, Asp.Net MVC

By providing the above code, the user won't be able to come back to first page. Hence its better to provide a message to the user before leaving the first page. Message can be provided on the beforeUnload javascript function as shown below.

Disable Browser's Back Button, How To Disable Browser Back Button, Back Button Disable, Asp.Net, Disable Browser's Back Button Using Javascript, Disable Browser's Back Button Using Jquery, Window.History.Forward, Window.Onunload, Window.Onbeforeunload, Window.Location.Hash, HTML, PHP, Jquery, Javascript, Asp.Net MVC