谷歌浏览器或IE可用,其他浏览器未测..
JS
var ConsoleManager = {
onOpen: function() {},
onClose: function() {},
init: function() {
var self = this;
var x = new Image();
var isOpening = false,
isOpened = false;
Object.defineProperty(x, 'id', {
get: function() {
if (!isOpening) {
self.onOpen();
isOpening = true;
}
isOpened = true;
}
});
setInterval(function() {
isOpened = false;
console.info(x);
console.clear();
if (!isOpened && isOpening) {
self.onClose();
isOpening = false;
}
}, 200);
}
}
ConsoleManager.onOpen = function() {
document.documentElement.innerHTML = '<p style="text-align: center">小崽子,瞅你妹</p>';
}
ConsoleManager.onClose = function() {
window.location.reload();
}
ConsoleManager.init();