• 网页禁止右键,禁止F12,禁止选中,禁止复制,禁止缓存等操作


    一、禁止右键

                //方法一
           document.onmousedown = function () { if (event.button == 2) { return false; } }
           //方法二  document.oncontextmenu
    = function () { return false; }

    二、禁止F12

                //方法一
           document.onkeydown = function (e) { var currentKey = 0, k = e || window.event; currentKey = k.keyCode || k.which || k.charCode; if (currentKey == 123) { window.event.cancelBubble = true; window.event.returnValue = false; } }
           //方法二 document.onkeydown
    = function () { if (window.event && window.event.keyCode == 123) { window.event.returnValue = false; } }

    三、禁止选中

                body{
                    -webkit-user-select:none;
                    -moz-user-select:none;
                    -ms-user-select:none;
                    user-select:none;
                }

    四、禁止复制

                function noCopy(){   
                    event.returnValue = false;   
                }
           <body oncopy="noCopy()"></body>

    五、禁止缓存

            <meta http-equiv="Pragma" content="no-cache"/>  
            <meta http-equiv="Cache-Control" content="no-cache"/>  
            <meta http-equiv="Expires" content="0"/> 
  • 相关阅读:
    Android变化如何破解几场金
    mysql 在创建批处理脚本日志表信息
    近期感悟要多说多想多做
    Spring使用小结2
    structs2使用小结2
    2013第50周五打包
    2013第50周四开发记
    jquery使用总结
    2013第50周三开发记
    eclipse编辑工具小结
  • 原文地址:https://www.cnblogs.com/guomin/p/9177729.html
Copyright © 2020-2023  润新知