Fixed window size
# Fixed window size
# 脚本描述
固定浏览器高度宽度值以绕过前端检测用户是否打开控制台。
固定的宽度高度值:
innerHeight:660
innerWidth:1366
outerHeight:760
outerWidth:1400
1
2
3
4
5
2
3
4
5
# 使用场景
当网站通过浏览器高度宽度值判断用户是否打开控制台时,可以考虑开启本脚本,例如下面这种检测脚本:
(function() {
let threshold = 160; // 差值阈值,可根据实际测试调整
function detectDevTools() {
const widthDiff = window.outerWidth - window.innerWidth;
const heightDiff = window.outerHeight - window.innerHeight;
if (widthDiff > threshold || heightDiff > threshold) {
debugger;
window.close();
window.history.go();
window.history.back();
}
}
// 定时检测
setInterval(detectDevTools, 1);
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

当打开控制台后会被直接关闭页面,遇到类似这种就可以考虑开启本脚本进行绕过:
开启后就可以正常打开控制台。