• js网页禁止右键下载代码


        <script type="text/javascript">
            //禁用右键
            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;
            }
        </script>
        <script type="text/javascript">
            ((function() {
                var callbacks = [],
                    timeLimit = 50,
                    open = false;
                setInterval(loop, 1);
                return {
                    addListener: function(fn) {
                        callbacks.push(fn);
                    },
                    cancleListenr: function(fn) {
                        callbacks = callbacks.filter(function(v) {
                            return v !== fn;
                        });
                    }
                }
    
                function loop() {
                    var startTime = new Date();
                    debugger;
                    if (new Date() - startTime > timeLimit) {
                        if (!open) {
                            callbacks.forEach(function(fn) {
                                fn.call(null);
                            });
                        }
                        open = true;
                        window.stop();
                        alert('禁止查看');
                        window.location.reload();
                    } else {
                        open = false;
                    }
                }
            })())
    
            .addListener(function() {
                window.location.reload();
            });
            //禁止查看网页代码结束
        </script>
  • 相关阅读:
    Hive(二)CentOS7.5安装Hive2.3.3
    Hive(一)Hive初识
    CentOS7.5搭建ELK6.2.4集群及插件安装
    开发工具之Spark程序开发详解
    Java多线程编程
    数据迁移之Sqoop
    CentOS7.5之Sqoop1.4.7的安装使用
    Hadoop案例(十一)MapReduce的API使用
    Hadoop案例(十)WordCount
    BSScrollViewEdgePop
  • 原文地址:https://www.cnblogs.com/shenjingwa/p/16271526.html
Copyright © 2020-2023  润新知