禁止浏览器打开控制台~
1、单纯的禁止
window.oncontextmenu = function () { return false; }
2、禁止键盘打开
window.onkeydown = window.onkeyup = window.onkeypress = function () { window.event.returnValue = false; return false; }
3、禁止开发者工具打开
var h = window.innerHeight, w = window.innerWidth; window.onresize = function () { if (h != window.innerHeight || w != window.innerWidth) { window.close(); window.location = "about:blank"; } }
4、你妹的开发者工具是全屏了怎么搞
if (window.addEventListener) { window.addEventListener("DOMCharacterDataModified", function () { window.location.reload(); }, true); window.addEventListener("DOMAttributeNameChanged", function () { window.location.reload(); }, true); window.addEventListener("DOMCharacterDataModified", function () { window.location.reload(); }, true); window.addEventListener("DOMElementNameChanged", function () { window.location.reload(); }, true); window.addEventListener("DOMNodeInserted", function () { window.location.reload(); }, true); window.addEventListener("DOMNodeInsertedIntoDocument", function () { window.location.reload(); }, true); window.addEventListener("DOMNodeRemoved", function () { window.location.reload(); }, true); window.addEventListener("DOMNodeRemovedFromDocument", function () { window.location.reload(); }, true); window.addEventListener("DOMSubtreeModified", function () { window.location.reload(); }, true); }