Last active
April 25, 2017 19:20
-
-
Save ManUtopiK/bc5d1b2e5a1d8f32284d23a7b3512f38 to your computer and use it in GitHub Desktop.
Hack to detect if chrome devtools is open
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'); | |
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