虎牙 PC 网页端是屏蔽了 MutationObserver 功能吗?

2022-02-10 08:41:57 +08:00
 thefack

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

  // 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
  })
609 次点击
所在节点    问与答
2 条回复
BreadKiller
2022-02-10 10:43:21 +08:00
看了一下只是重写 console.log 这个方法而已
thefack
2022-02-10 18:19:14 +08:00
@BreadKiller 谢谢大哥啊,学到了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/832815

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX