Before, I asked a question, website detect whether the developer tools are enabled?
The problem is very hot, it was the top1 problem in May, and the administrator deleted it for me later...
Here, record this problem and its solution.
Methods such as monitoring keyboard events F12, do not record, because everyone was playing like this at the beginning.
method one
below chrome72
var im = new Image();
Object.defineProperty(im, 'id', {
get: function() {
window.location.href = "http://106.53.103.200:8082/error.html"
blast();
}
});
console.log(im); //谷歌最新版失效
The principle is that chrome will read all the id elements on the page when opening the console.
Method Two
let num = 0; //谷歌最新版有效
var devtools = new Date();
devtools.toString = function() {
num++;
if (num > 1) {
window.location.href = "http://106.53.103.200:8082/error.html"
blast();
}
}
console.log('', devtools);
Only when the console is turned on, the console printing method will be executed, thus controlling.
The above two methods can be said to be unsolvable. No one can open the console. Both methods are achieved by using data hijacking or rewriting some core methods. It is worth thinking about.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。