下面这段代码我试过很多网站,是可以检测到网页改变的,但是对虎牙主播的直播页面完全无效,就算写成扩展也无效,这是怎么做到的?
// Create callback function to execute when changes are observed
let fun= function (records) {
// 无论怎么增删元素,都不输出这句
console.log("检测到改动", records)
}
// Create an observer instance linked to the callback function
let observer = new MutationObserver(fun)
// Start observing the target node for configured mutations(changes)
observer.observe(document.body, {
attributes: true,
childList: true,
subtree: true
})
1
BreadKiller 2022-02-10 10:43:21 +08:00
看了一下只是重写 console.log 这个方法而已
|
2
thefack OP @BreadKiller 谢谢大哥啊,学到了
|