wordpress防文字复制,图片拖放,鼠标右键

将以下代码放大head.php的<?php wp_head(); ?>后面:

<script>
// 禁止右键
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);
</script>

 

©️李联华的博客网 当前IP地址:3.145.162.12,归属地:俄亥俄州Dublin ,欢迎您的访问!

温馨提示 : 非特殊注明,否则均为李联华的博客原创文章,本站文章未经授权禁止任何形式转载
文章链接:https://www.ooize.com/wordpress-anti-text-copy-picture-drag-and-drop-right-mouse-button.html
订阅
提醒
guest
0 评论
内联反馈
查看所有评论
Loading...