I've written two HTML files:
- Login.html
<a href = "Home.html">Next Page</a> - Home.html`
<html> <body> <a href = >Login.html>>Prev Page</a> </body> <script type = "text/javascript" > history.pushState("anything", "", "#1"); window.onhashchange = function (event) { window.location.hash = "a"; }; </script> </html> ` I'm trying to disable browser's back button. If i execute this code on chrome it doesn't disable the back button but if i run history.state command in console of Home.html page and then i click the back button, then it remains on same page(works as expected). Why so?