禁止浏览器查看源代码

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

posted @ 2018-01-22 17:48  捞档哥  阅读(1342)  评论(0编辑  收藏  举报