質問

I'm developing a Google Chrome extension. Its content script should fire every time the page it's on changes, and it does most of the times. I'm using a MutationObserver for this.

However, when I'm on Youtube (and possibly other websites in which I haven't noticed the problem) and I scroll down to load the comments, the MutationObserver doesn't fire. Why is this, shouldn't the DOM have changed?

EDIT: I might want to add that I set the observer to monitor changes in the subtree, childList and attribute of document.body.

役に立ちましたか?

解決

YouTube comments are loaded in an iframe. If you want to watch for mutations of YouTube comments you have to set your content script to be "all_frames": true in the manifest and add the iframe URL pattern to match against.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top