Breaking News
January 24, 2017

How to Disable Back Button on your Browser

Tuesday, January 24, 2017

Codes - Pexels | Geeky JuanRecently, we're making a web application where using the "Back" button of the browser should be disabled. So here I am today sharing yet another script to help you guys with the same issue! Just to clear things out, this script was found in StackOverflow and we were more than glad to have these wonderful people sharing their knowledge for the likes of us who continually desired  to grow!

 window.onload = function undefined) {
        if undefinedtypeof history.pushState === "function") {
            history.pushStateundefined"jibberish", null, null);
            window.onpopstate = function undefined) {
                history.pushStateundefined'newjibberish', null, null);
                // Handle the back undefinedor forward) buttons here
                // Will NOT handle refresh, use onbeforeunload for this.

Place this on your HTML codes and see how the magic works! This sure worked for us! Kudos to its original creator!
Share your thoughts


Post a Comment

Toggle Footer
Web Statistics