惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
J
Java Code Geeks
D
DataBreaches.Net
U
Unit 42
P
Proofpoint News Feed
I
InfoQ
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
博客园 - Franky
博客园_首页
IT之家
IT之家
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志

WangDeer

非机动车交通规则测验 微软 50 周年壁纸是在 macOS上设计的? 「转」西二旗折叠:蜂巢经济学启示录 难得空明 Ubuntu Clean ApidocJs apigroup Support Chinese int(10)里面的10是什么意思? 5-3 会话 2021-03-25 「PHP架构师」面试准备 Laravel 上传 Docx 文件,表单验证不通过 4-4 发送信号 4-3 信号集 4-2 编写中断信号处理程序 2022-03-10 面试复盘 4-1 什么是中断信号(软中断) 3-7 进程查看 3-6 SUID特权进程 3-5多进程编写 3-4进程调度 3-3进程exec 3-2进程退出和回收 3-1进程标识与fork 2-3解释器文件 2-2命令行参数与环境参数表 2-1程序与进程 1-1课程介绍 终极复盘 第八章 传承篇 第七章 自由篇 第六章 品牌篇
网页禁止鼠标右键
王二 · 2014-10-21 · via WangDeer
  1. 禁止鼠标左右键代码/禁止网页选中/禁止另存为/防复制代码
<body oncontextmenu="return false" onselectstart="return false">
<noscript><iframe src="/*.html>";</iframe></noscript>
<script>
function stop(){
    return false;
}
document.oncontextmenu=stop;
</script>
  1. 禁止鼠标左右键
<script language=javascript>
    if (window.Event)
        document.captureEvents(Event.MOUSEUP);
        function nocontextmenu(){
            event.cancelBubble = true
            event.returnValue = false;
            return false;
        }
        function norightclick(e){
            if (window.Event){
                if (e.which == 2 || e.which == 3)
                return false;
            }
            else
            if (event.button == 2 || event.button == 3){
                event.cancelBubble = true
                event.returnValue = false;
                return false;
            }
        }
        document.oncontextmenu = nocontextmenu; // for IE5+
        document.onmousedown = norightclick; // for all others
</script>
  1. 禁止选中代码
<script language=JavaScript>
document.oncontextmenu=new Function("event.returnValue=false;");
document.onselectstart=new Function("event.returnValue=false;");
</script>
  1. 禁止另存为
<noscript>
<iframe src="/*.htm"></iframe>
</noscript>
  1. 防拷贝/复制代码
<body leftmargin=0 topmargin=0 >
  1. 禁止选择文本
<script type="text/javascript">
    var omitformtags=["input", "textarea", "select"]
    omitformtagsomitformtags=omitformtags.join("|")

    function disableselect(e){
        if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
        return false
    }
    function reEnable(){
        return true
    }
    if (typeof document.onselectstart!="undefined")
        document.onselectstart=new Function ("return false")
    else{
        document.onmousedown=disableselect
        document.onmouseup=reEnable
    }
</script>
  1. 禁用右键
<script>
function stop(){
    return false;
}
document.oncontextmenu=stop;
</script>
  1. 真正的鼠标右键屏蔽
<script language="JavaScript">
<!--

if (window.Event)
    document.captureEvents(Event.MOUSEUP);

function nocontextmenu()
{
    event.cancelBubble = true
    event.returnValue = false;

    return false;
}

function norightclick(e)
{
    if (window.Event)
    {
        if (e.which == 2 || e.which == 3)
        return false;
    }
    else
    if (event.button == 2 || event.button == 3)
    {
        event.cancelBubble = true
        event.returnValue = false;
        return false;
    }

}

document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
</script>