|
21 | 21 | <body onpaste="return false">
|
22 | 22 | <div id="root"></div>
|
23 | 23 | </body>
|
| 24 | + <script> |
| 25 | + window.onload = function () { |
| 26 | + const detectDevTool = (allow) => { |
| 27 | + let a = false; |
| 28 | + if (isNaN(+allow)) allow = 100; |
| 29 | + const start = +new Date(); |
| 30 | + debugger; |
| 31 | + const end = +new Date(); |
| 32 | + if (isNaN(start) || isNaN(end) || end - start > allow) { |
| 33 | + alert("DEVTOOLS detected. all operations will be terminated."); |
| 34 | + window.location.href = "/"; |
| 35 | + } |
| 36 | + }; |
| 37 | + |
| 38 | + if (window.attachEvent) { |
| 39 | + if ( |
| 40 | + document.readyState === "complete" || |
| 41 | + document.readyState === "interactive" |
| 42 | + ) { |
| 43 | + detectDevTool(); |
| 44 | + window.attachEvent("onresize", detectDevTool); |
| 45 | + window.attachEvent("onmousemove", detectDevTool); |
| 46 | + window.attachEvent("onfocus", detectDevTool); |
| 47 | + window.attachEvent("onblur", detectDevTool); |
| 48 | + } else { |
| 49 | + setTimeout(arguments.callee, 0); |
| 50 | + } |
| 51 | + } else { |
| 52 | + window.addEventListener("load", detectDevTool); |
| 53 | + window.addEventListener("resize", detectDevTool); |
| 54 | + window.addEventListener("mousemove", detectDevTool); |
| 55 | + window.addEventListener("focus", detectDevTool); |
| 56 | + window.addEventListener("blur", detectDevTool); |
| 57 | + } |
| 58 | + }; |
| 59 | + </script> |
24 | 60 | </html>
|
0 commit comments