码迷,mamicode.com
首页 > 其他好文 > 详细

禁止浏览器查看源代码

时间:2018-01-22 19:12:44      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:ctrl   cti   arguments   ext   www   win   false   document   logs   

window.onload = function() {
        document.onkeydown = function() {
            var e = window.event || arguments[0];
            //屏蔽F12
            if(e.keyCode == 123) {

                return false;
             //屏蔽Ctrl+Shift+I
            } else if((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)) {

                return false;
                //屏蔽Shift+F10
            } else if((e.shiftKey) && (e.keyCode == 121)){
                 return false;
            }
        };
        //屏蔽右键单击
        document.oncontextmenu = function() {
            return false;
        }
    }

 文章出处:http://www.cnblogs.com/hollow/articles/6380660.html

禁止浏览器查看源代码

标签:ctrl   cti   arguments   ext   www   win   false   document   logs   

原文地址:https://www.cnblogs.com/xushengguan/p/8330310.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!