请注意,本文编写于 646 天前,最后修改于 620 天前,其中某些信息可能已经过时。
屏蔽F12
1.事先引入layer.js来提示信息,至后台-开发者设置-自定义输出body 尾部的HTML代码
;
/*禁止F12引入js*/
<script src="https://lib.baomitu.com/layer/3.1.1/layer.js"></script>
2.将以下代码添加至后台-开发者设置-自定义JavaScript
/*禁止F12*/
document.onkeydown = function(){
if(window.event && window.event.keyCode == 123) {
layer.msg("F12被禁用");
event.keyCode=0;
event.returnValue=false;
}
}
禁止复制
代码:
/*禁止复制*/
<body onmousemove=HideMenu() oncontextmenu="return false"
ondragstart="return false"
onselectstart ="return false"
onselect="document.selection.empty()"
oncopy="document.selection.empty()"
onbeforecopy="return false"
onmouseup="document.selection.empty()">
</body>
复制上面的代码
进入后台——开发者设置——自定义输出body 尾部的HTML代码
来源:陶小桃blog