This does not work on recent versions of Chrome and FireFox!
This is a hack to detected whether the developer tools of the browser are open or closed. It also works if the development tools are not docked.
HTML Code:
status: <div id="c"></div>
JavaScript Code:
var isOn;
var t1 = new Image();
var t2 = new Image();
Object.defineProperty(t1, "id", {
get:function() {
isOn = true;
throw new Error("");
}
});
t2.__defineGetter__("id", function(){ isOn = true; });
setInterval(function() {
isOn = false;
console.dir(t1);
console.log(t2);
console.clear();
document.getElementById("c").innerHTML = isOn ? "on" : "off";
}, 1000);
JSFiddle Demo: https://jsfiddle.net/1dojo5er/