【JS】禁止页面右键查看源码及拖选复制功能
// 禁止右键 Laobuluo.comdocument.oncontextmenu = function () {
return false;
};
// 禁止图片拖放
document.ondragstart = function () {
return false;
};
// 禁止选择文本
document.onselectstart = function () {
if (event.srcElement.type !== "text" && event.srcElement.type !== "textarea" && event.srcElement.type !== "password") return false;
else return true;
};
if (window.sidebar) {
document.onmousedown = function (e) {
var obj = e.target;
if (obj.tagName.toUpperCase() === "INPUT" || obj.tagName.toUpperCase() === "TEXTAREA" || obj.tagName.toUpperCase() === "PASSWORD") return true;
else return false;
};
}
// 禁止frame标签引用
if (parent.frames.length > 0) top.location.replace(document.location);
//禁止F12 By cnwper.com
document.onkeydown = document.onkeyup = document.onkeypress = function (event) {
var e = event || window.event || arguments.callee.caller.arguments;
if (e && e.keyCode === 123) {
mAlert();
e.returnValue = false;
return false;
}
};
参考:hondy.site.user.js.function
页:
[1]