您的位置:首页 > 编程语言

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

2017-07-10 22:51 330 查看
chrome浏览器

1.Ctrl+Shift+I
F12
右键+N

2.Ctrl+U
3.在网址前加  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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息