1. 禁用鼠标右键
document.oncontextmenu = new Function("return false;");
2. 禁用F12,Ctrl+Shift+I,Shift+F10
document.onkeydown = function(){
var e = window.event || arguments[0];
if(e.keyCode == 123){ //屏蔽F12
return false;
}else if(e.ctrlKey && e.shiftKey && e.keyCode == 73){ //屏蔽Ctrl+Shift+I,等同于F12
return false;
}else if(e.shiftKey && e.keyCode == 121){ //屏蔽Shift+F10,等同于鼠标右键
return false;
}
}
3. 循环跳转debug
((function() {
var callbacks = [],
timeLimit = 50,
open = false;
setInterval(loop, 1);
return {
addListener: function(fn) {
callbacks.push(fn);
},
cancleListenr: function(fn) {
callbacks = callbacks.filter(function(v) {
return v !== fn;
});
}
}
function loop() {
var startTime = new Date();
debugger;
if (new Date() - startTime > timeLimit) {
if (!open) {
callbacks.forEach(function(fn) {
fn.call(null);
});
}
open = true;
window.stop();
alert('大佬别扒了!');
document.body.innerHTML = "";
} else {
open = false;
}
}
})()).addListener(function() {
window.location.reload();
});
(function (a) {
return (function (a) {
return (Function('Function(arguments[0]+"' + a + '")()'))
})(a)
})('bugger')('de', 0, 0, (0, 0));
其他:清理console.log
console.clear();
评论区