
http://stackoverflow.com/questions/7798748/find-out-whether-chrome-console-is-open
In my case,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isInspectOpen() | |
{ | |
console.profile(); | |
console.profileEnd(); | |
if (console.clear) console.clear(); | |
return console.profiles.length > 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onresize = function() | |
{ | |
if ((window.outerHeight - window.innerHeight) > 100) | |
alert('Docked inspector was opened'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var checkStatus; | |
var element = new Image(); | |
// var element = document.createElement('any'); | |
element.__defineGetter__('id', function() { | |
checkStatus = 'on'; | |
}); | |
setInterval(function() { | |
checkStatus = 'off'; | |
console.log(element); | |
console.clear(); | |
document.querySelector('#devtool-status').innerHTML = checkStatus; | |
}, 1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var element = new Image(); | |
Object.defineProperty(element, 'id', { | |
get: function () { | |
/* TODO */ | |
alert('囧'); | |
} | |
}); | |
console.log('%cHello', element); |
I use check4.js
check1.js, check2.js code can't check developer tools open event.
check3.js code check using setInterval() function.
check4.js
code use Object definedProperty() function on get() function.
console.log("%c hello", element)
When console.log called, element object call get() function.
And you can check developer tools open
Happy Coding!