0
点赞
收藏
分享

微信扫一扫

网站怎么禁止右键禁止F12代码JS

倚然君 2022-03-16 阅读 75

禁止右键和F12只能避免一些初级想偷代码的人!

  <script language="javascript">
        function click() {
        if (event.button==2) {
        alert('想右键查看源代码?大胸弟,别想啦')
        }
        }
        document.onmousedown=click
        
        </script>
        <script>
        document.onkeydown = function(){
            if(window.event && window.event.keyCode == 123) {
                alert("右键不成还想直接f12?告诉你这是不可能的!大胸弟这么执着吗?");
                event.keyCode=0;
                event.returnValue=false;
            }
            if(window.event && window.event.keyCode == 13) {
                window.event.keyCode = 505;
            }
            if(window.event && window.event.keyCode == 8) {
                alert(str+"\n请使用Del键进行字符的删除操作!");
                window.event.returnValue=false;
            }
        }
        document.oncontextmenu = function (event){
            if(window.event){
            event = window.event;
            }
            try{
            var the = event.srcElement;
                if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
                return false;
                }
                return true;
            }
            catch (e){
                return false;
            }
        }
        </script>

右键提示图

F12提醒图

想要跳过禁右键禁F12查看网站源码教程

举报

相关推荐

0 条评论