防止查看源代码进行复制的方法
参考:https://www.cnblogs.com/ypppt/p/12942773.html
<script language="javascript">
function click(e) {
if(document.all) {
if(event.button == 2 || event.button == 3) {
oncontextmenu = 'return false';
}
}
if(document.layers) {
if(e.which == 3) {
oncontextmenu = 'return false';
}
}
}
if(document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown = click;
document.oncontextmenu = new Function("return false;")
document.onkeydown = document.onkeyup = document.onkeypress = function() {
//123屏蔽F12,73屏蔽Ctrl+Shift+I,121屏蔽Shift+F10
if(window.event.keyCode == 123 || window.event.keyCode == 73 || window.event.keyCode == 121) {
window.event.returnValue = false;
return(false);
}
}
</script>

浙公网安备 33010602011771号