1. 锁定右键
将网页中的 <body>
换为如下代码即可:
<body oncontextmenu="return false" ondragstart="return false" onselectstart="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()">
2. 拒绝另存
<noscript><iframe src="/*"></iframe></noscript>
3. 不准粘贴
onpaste="return false"
4. 防止复制
oncopy="return false;" oncut="return false;"
5. 关闭输入法
<input style="ime-mode:disabled">
6. JS 屏蔽鼠标右键
/** 屏蔽鼠标右键 */
document.oncontextmenu = function() { return false; };
// 或者
document.onmousedown = function(event) {
event = window.event || event;
if (document.all && event.button == 2) {
event.returnValue = false;
}
};
7. 禁用 F12 调试键(但是不支持火狐)
document.onkeydown = function(e) {
var currKey = 0, evt = e || window.event;
currKey = evt.keyCode || evt.which || evt.charCode;
if (currKey == 123) {
window.event.cancelBubble = true;
window.event.returnValue = false;
}
};
评论区