Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I try a lot of ways to disabled console but not working. So how to disabled it?

I search on Internet about this, then i tried some ways but it not working.
My code:

    <script type="text/javascript">
        (function () {

            var _z = console;
            Object.defineProperty(window, "console", {
                get: function () {
                    if (_z._commandLineAPI) {
                        throw "Sorry, Can't execute scripts!";
                    }
                    return _z;
                },
                set: function (val) {
                    _z = val;
                }
            });

        })();
    </script>

this way not working too!

    <script type="text/javascript">
        window.console.log = function () {
            console.error('Sorry , developers tools are blocked here....');
            window.console.log = function () {
                return false;
            }
        }
    </script>

First I think my browser isn’t supporting this code or disabled this, then I try other browser but they aren’t working

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You cannot do anything about the console or developer tools in general as they are on the client side. Those above used to work, but no longer do since ES6.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading