Skip to content Skip to sidebar Skip to footer

Content Script Is Not Working In Chrome Extension

I use XMLHttpRequest in content script. The code works whenever a new tab opens, but it stops working whenever a tab is updated. tabupdation API only works in background. Manifes

Solution 1:

You have probably misunderstood the concept of the chrome.tabs.onUpdated event. It does not fire when the content of a tab's web-page is updated, but when the tab's properties are updated (e.g. when you reload the tab, the url property is updated).

Clicking on a link that loads a different video into the current web-page (e.g. through AJAX) does not trigger an onUpdated event.

If you want to listen for changes in the web-page itself, you should look into MutationObserver. For some examples on using a MutationObserver within a Chrome Extension you can take a look here and there.

Post a Comment for "Content Script Is Not Working In Chrome Extension"