逼哥分享了个好玩的东西,里面有一段代码,可以让浏览器在开启 F12 的 devtool 工具的时候,自动跳转到百度页面。
这是他的网站 - https://weather.zjinh.cn/
逼哥也分享了代码和讲解了逻辑,感谢逼哥的分享,我在这分享一下。
1 | var element = new Image(); |
然后我再网上也找了几个大同小异的代码
1 | var minimalUserResponseInMiliseconds = 100; |
1 | var devtools = function () {}; |
还有个检测函数
1 | function isInspectOpen() { |
参考文章
- https://stackoverflow.com/questions/16765287/how-to-check-if-chrome-dev-tools-are-opened
- https://stackoverflow.com/questions/42193700/detect-when-inspect-element-is-open
- https://stackoverflow.com/questions/40153206/detect-if-console-devtools-is-open-in-all-browsers
- https://stackoverflow.com/questions/7798748/find-out-whether-chrome-console-is-open/19256983#19256983