Skip to content

Instantly share code, notes, and snippets.

@ManUtopiK
Last active April 25, 2017 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ManUtopiK/bc5d1b2e5a1d8f32284d23a7b3512f38 to your computer and use it in GitHub Desktop.
Save ManUtopiK/bc5d1b2e5a1d8f32284d23a7b3512f38 to your computer and use it in GitHub Desktop.
Hack to detect if chrome devtools is open
var checkStatus;
var element = new Image();
// var element = document.createElement('any');
Object.defineProperty(element, 'id', {
get:function() {
checkStatus='on';
throw new Error("This is a hack to check If chrome Devtools is open. Pay no attention.............................................................................................................");
}
});
setInterval(function() {
checkStatus = 'off';
console.dir(element);
document.querySelector('#devtool-status').innerHTML = checkStatus;
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment