javascript - how to restrict going to back in firefox (private window)? -
i make simple html , open in firefox (new private window).i run in new private window .when press backspace display same screen same when open new private window.it why? can restrict on same page on pressing ? used lot of things nothing work .
<!doctype html> <html> <head> </head> <body> <h1>my web page</h1> <p id="demo">a paragraph.</p> <button type="button" onclick="myfunction()">try it</button> </body> </html> $('html').keyup(function (e) { if (e.keycode == 8) { e.preventdefault(); e.stopimmediatepropagation(); e.stoppropagation(); alert('backspace trapped') return ; } e.preventdefault(); e.stopimmediatepropagation(); e.stoppropagation(); })
try this..
just insert within head.
<script type="text/javascript"> function noback(){window.history.forward()} noback(); window.onload=noback; window.onpageshow=function(evt){if(evt.persisted)noback()} window.onunload=function(){void(0)} </script>
Comments
Post a Comment