下面这段代码我试过很多网站,是可以检测到网页改变的,但是对虎牙主播的直播页面完全无效,就算写成扩展也无效,这是怎么做到的?
// 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
})