The browser’s back button allows the user to redirect back to the previous page that accessing before the current page. If you want to restrict users to back the previous page on your web application, the browser back button needs to be disabled. The browser’s back navigation can be disabled with JavaScript. Use history.pushState()
event and onpopstate
property of the WindowEventHandlers to stop back navigation on browsers.
The following code snippet disables the browser back button using JavaScript.
window.history.pushState(null, null, window.location.href);
window.onpopstate = function () {
window.history.go(1);
};