Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Detect if browser console is opened.(Chrome 38.0.2125.111 m,IE 11 is tested)
<!doctype html>
<meta charset="utf-8" />
<title>console track</title>
console status: <span id="stat"></span>
function isConsoleOpen() {
var el = document.createElement('div');
var ret = false;
el.__defineGetter__('id', function() {ret = true});
return ret;
// test
setInterval(function() {
stat.innerHTML = isConsoleOpen() ? 'open' : 'closed';
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.