参考文档:https://mp.weixin.qq.com/s/TfqH-4FC10df2zMEpQ1Y_g

    1. (() => {
    2. function block() {
    3. if (
    4. window.outerHeight - window.innerHeight > 200 ||
    5. window.outerWidth - window.innerWidth > 200
    6. ) {
    7. console.log(9999)
    8. document.body.innerHTML =
    9. "检测到非法调试,请关闭后刷新重试!";
    10. }
    11. setInterval(() => {
    12. (function () {
    13. return false;
    14. }
    15. ["constructor"]("debugger")
    16. ["call"]());
    17. }, 50);
    18. }
    19. try {
    20. block();
    21. } catch (err) {}
    22. })();