Ben McCann
Ben McCann

Reputation: 18994

chrome.tabs.onUpdated reacting to iframes

chrome.tabs.onUpdated is being called whenever a tab's URL changes or the URL of any of the iframes it contains are updated. Is this the expected result? Is there anyway to filter out iframes changing?

Upvotes: 2

Views: 921

Answers (1)

Rob W
Rob W

Reputation: 348962

Yes, simply use the second parameter of the chrome.tabs.onUpdated callback function:

chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
    if (changeInfo.url) {
        // The URL changed, do something
    }
});

Upvotes: 3

Related Questions