I Want To Disable Browsers Back Button, I Have Tried A Code Which Is Working For Internet Explorer But Facing Problem In Chrome
It is working good in internet exlporer but in chrome it works only if the user clicks on somewhere in the page i.e., works only when the user gives a click on that page at least
Solution 1:
I've stumbled on this question quite a lot and I had to achive the same thing
might not be the best solution, but I've made it to work in browsers IE, Explorer, Chrome, did not test Firefox tho, with this code:
<scripttype = "text/javascript" >
history.pushState(null, null, location.href);
history.back();
history.forward();
window.onpopstate = function () {
history.go(1);
};
</script>
The problem with Chrome is that it doesn't trigger onpopstate event unless you make browser action ( i.e. call history.back). Thats why I've added those to script. After adding only that made it work in Chrome but other browsers stopped adding history.forward fixed it and started to work on every browser mentioned.
Source if you want to know more or at least what helped me solve this
Hope it helps!
Post a Comment for "I Want To Disable Browsers Back Button, I Have Tried A Code Which Is Working For Internet Explorer But Facing Problem In Chrome"