1

How to make this with js:
If console or Dev Tools is opened will perform function:

function(){
   alert('Console is open.');
};
Sherali Turdiyev
  • 1,745
  • 16
  • 29
Radi Cho
  • 680
  • 7
  • 21
  • I don’t think this is possible. The only indicator is using the `debugger;` statement which enables debugging capabilities only when the debugging tools are available, i.e. open. However, not even that is reliably the case. – Sebastian Simon Sep 12 '15 at 08:57

1 Answers1

2

If you are on Chrome you could use:

window.onresize = function()
{
    if ((window.outerHeight - window.innerHeight) > 100)
        alert('Docked inspector was opened');
}

Also Sindre Sorhus created an applet which you could use to detect whenever dev tools is open or not (https://stackoverflow.com/a/19256983/5252192).

I put some code here to tell what does it do. Head Here and import this in your page. then use the below code to detect when devtools opens or closed (it alerts on change of the state of the devtools).

window.addEventListener('devtoolschange', function (e) {
    var adsf = e.detail.open;
    if(adsf) {var qwer = "open.";}else{var qwer = "closed."}
    window.alert('dev tools is '+qwer);
});

Other possible solutions are Here

Community
  • 1
  • 1