chrome.tabs.onUpdated.addListener not fired when p

2019-02-14 02:42发布

问题:

This question already has an answer here:

  • Inconsistency with listeners - onUpdated on one machine and onReplaced on another machine 1 answer

I have the following listener:

chrome.tabs.onUpdated.addListener(function(tabId, change, tab) {
  if (change.status == "complete") {
    // Do something
  }
});

After upgrading my chromium browser from 16.x to 17.x I've paid an attention that this listener is not always fired. For example, when it seems like the page is retrieved from cache (loads very quickly) it doesn't fire. Then, if I reload the page, it's fired as usual.

Are there any changes made to this API method in 17.x?

Thanks!

回答1:

I've come across the same bug. In the meantime, I'm using the tabs.onActiveChanged event, which seems to fire when focus switches from the instant bar back to the tab. I'm not sure if it's a particularly robust solution, but so far it is working for me.