JavaScript 利用监听实现右键检查就 Debugger 程序员文章站 2022-07-02 19:27:56 文件上传 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>文件上传</title> </head> <body> <form action="http://localhost:8080/upload" method="POST"> <p> 上传人: <input type="text" name="username" /> </p> <p> 文件1: <input type="file" name="file1" /> </p> <p> 文件2: <input type="file" name="file2" /> </p> <input type="submit" /> | <input type="reset" /> </form> <h2>右键检查试试</h2> <script> var check = (function () { var callbacks = [], timeLimit = 2, open = false; setInterval(loop, 2); 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; } else { open = false; } } })(); check.addListener(function () { //alert('Open Devtool'); }); </script> </body> </html> 本文地址:https://blog.csdn.net/weixin_44953227/article/details/112576352 相关标签: JavaScript 上一篇: 详解Navicat远程连接mysql很慢 下一篇: 孝武烈皇后阿巴亥为何会遭人陷害?她是什么结局 推荐阅读 JavaScript 利用监听实现右键检查就 Debugger JavaScript 利用监听实现右键检查就 Debugger