
先将鼠标改为禁用状态,第一步
body:hover{
cursor:not-allowed;
}
设置禁用NoScript
禁用掉键盘的全部按键(键盘报废)
$(document).ready(function () {
document.body.onkeydown = function (event) {
if (window.event) {
//alert("不允许使用任何键盘按键");
return false;
}
}
});
实现全屏爆炸:这段代码很简单,当按下调试键的时候,全屏都是乱码,所有标签里都会填充为乱码,轻则直接可以让浏览器崩溃,经测试有些系统则可能会蓝屏!(慎用)
禁用F12调试键
禁用页面的ctrl功能,来禁止ctrl+S保存功能
禁用页面的ctrl功能,来禁止ctrl+C保存功能
//禁用页面的ctrl功能,来禁止ctrl+C保存功能
window.addEventListener('keydown', function (e) {
if(e.keyCode == 67 && (navigator.platform.match('Mac') ? e.metaKey : e.ctrlKey)){
e.preventDefault();
}
})
为右键添加自定义事件,禁用菜单右键!
// 为右键添加自定义事件,禁用菜单右键!
window.oncontextmenu = function() {
event.preventDefault(); // 阻止默认事件行为
return false;
}
当通过特殊途径打开浏览器调试窗口时,会无限刷新,导致无法调试
// 无限回写,阻碍调试
var x = document.createElement('div');
var isOpening = false;
Object.defineProperty(x, 'id', {
get:function(){
console.log("警告!控制台已被打开!");
window.location.reload()
}
});
console.info(x);
屏蔽Ctrl+Shift+I
//屏蔽Ctrl+Shift+I
window.addEventListener('keydown', function (e) {
if((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)){
e.preventDefault();
}
})
通过HTML实现反调试
实现自动跳转到百度
window.onkeydown = window.onkeyup = window.onkeypress = function (event) {
event.preventDefault();
window.event.returnValue = false;
}
window.oncontextmenu = function() {
event.preventDefault();
return false;
}
var threshold = 160;
window.setInterval(function() {
if (window.outerWidth - window.innerWidth > threshold || window.outerHeight - window.innerHeight > threshold){
window.location.href="https://www.baidu.com";
}
},100);
头部防范
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)