首页 > 技术文章 > js静止打开右键菜单和控制台

liuliang389897172 2018-11-23 14:27 原文

document.oncontextmenu = new Function("return false;");
document.onkeydown = document.onkeyup = document.onkeypress = function (e) {
var e = event || window.event || arguments.callee.caller.arguments[0];
if (e.keyCode == 123) {
alert('禁止打开控制台');
e.returnValue = false;
return (false);
}
}

推荐阅读