0

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

  • If you ask what I think you're asking: It's client-side, so you can't! Maybe you can find some relevant information here: https://stackoverflow.com/questions/7559409/how-to-disable-browser-developer-tools – T-S Apr 23 '22 at 00:31
  • The examples given by you were "tricks" that were allowed once upon a time. But not anylonger by any browser since 2015 or something. – T-S Apr 23 '22 at 00:36
  • What exactly are you trying to prevent here? – Bergi Apr 23 '22 at 03:05

1 Answers1

2

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.