Chrome extensions : How to know when a tab has finished loading, from the background page

google-chrome

Solution

Luckily have found the solution.

There is an additional parameter that holds the status value:

chrome.tabs.onUpdated.addListener(function (tabId , info) {
  if (info.status === 'complete') {
    // your code ...
  }
});

Status can be either `loading` or `complete`.

Problem

I'm using a listener in the background page to know when a tab is loaded: ``` chrome.tabs.onUpdated.addListener(function (tabId) { }) ``` But the listener is fired twice: when the page has started loading, and when the page has finished.Is there a way to differentiate the two cases?

Original source

Related problems