In this article, we will learn how to disable the back button in the browser using JavaScript.
Open the index.html file and add the code in it.
<!DOCTYPE html> <html> <head> <script> history.pushState(null, null, location.href); window.onpopstate = function () { history.go(1); }; </script> </head> <body> Welcome </body> </html>
That’s it.
Output:
Also, check Detect Inactivity In Browser Using JavaScript
thank you bro, you save my day
You’re welcome 🙂