弘帝企业智能建站系统交流平台

 找回密码
 立即注册
查看: 1390|回复: 0

【JS】禁止页面右键查看源码及拖选复制功能

[复制链接]
发表于 2020-9-21 23:28:23 | 显示全部楼层 |阅读模式
// 禁止右键 Laobuluo.com
document.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[0];
    if (e && e.keyCode === 123) {
        mAlert();
        e.returnValue = false;
        return false;
    }
};

参考:hondy.site.user.js.function
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|弘帝企业智能建站系统 ( 皖ICP备07503252号 )

GMT+8, 2024-4-26 03:11 , Processed in 0.096649 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表