我想制作一个小脚本来检查控制台是否打开。我看了很多帖子,大多数都说不可能了。然而,我发现一个这样说的:
... I added a small script that would redirect the player to a 404 if they opened devtools. To accomplish this, I created an Image with a getter, which was logged to console. If console was opened, the getter would be triggered, and the user would be 404'd.
这可能吗?如果是,那么如何使用 getter 来完成?
最佳答案
var element = new Image()
Object.defineProperty(element, 'id', {
get() {
alert('Hello')
}
})
console.log(element)
关于javascript - 检测是否通过 getter 查看图像(在控制台中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65430731/