仿站咨询QQ:2587483189

手机微信同号:15850888840

终极代码禁止查看网页源代码方法

 总是有新手问,如何禁止别人查看自己的网页源代码?答案是没有,对于有经验者所有方法都是徒劳的。一般常用的方法是在网页中加上类似的 JS 代码,屏蔽屏蔽键盘和鼠标仿站右键。

 
 document.onkeydown = function() {
    var e = window.event || arguments[0];
    if (e.keyCode == 123) {
    alert('禁止F12');
    return false;
    } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)) {
    alert('禁止Ctrl+Shift+I');
    return false;
    } else if ((e.ctrlKey) && (e.keyCode == 85)) {
    alert('禁止Ctrl+u');
    return false;
    } else if ((e.ctrlKey) && (e.keyCode == 83)) {
    alert('禁止Ctrl+s');
    return false;
    }
    }
    // 屏蔽鼠标右键
    document.oncontextmenu = function() {
    alert('禁止右键');
    return false;
来源:未知//所属分类: dede仿站 /更新时间:2022-02-09
相关仿站教程
  • 相关链接:

    复制本页链接

  • 教程说明:

    终极代码禁止查看网页源代码方法