查看网页代码,禁用右键、F12查看

来源:互联网 发布:链路状态协议网络拓扑 编辑:程序博客网 时间:2024/05/17 03:52

chrome浏览器

1.Ctrl+Shift+I    F12    右键+N2.Ctrl+U3.在网址前加  view-source: 

禁用右键、F12查看代码的方式:

I

<script>             document.oncontextmenu = function () {                 return false; };             document.onkeydown = function () {            if (window.event && window.event.keyCode == 123) {                event.keyCode = 0;                event.returnValue = false;                return false;            }            };    </script>

II

<script>        function click(e) {            if (document.all) {                if (event.button == 2 || event.button == 3) {                    alert("1");                    oncontextmenu = 'return false';                }            }            if (document.layers) {                if (e.which == 3) {                    oncontextmenu = 'return false';                }            }        }        if (document.layers) {            document.captureEvents(Event.MOUSEDOWN);        }        document.onmousedown = click;        document.oncontextmenu = new Function("return false;")        document.onkeydown = document.onkeyup = document.onkeypress = function() {            if (window.event.keyCode == 123) {                window.event.returnValue = false;                return (false);            }        }    </script>
原创粉丝点击