apdev
apdev

Reputation: 125

chrome.webNavigation.onTabReplaced not firing

I am working on Google extension code and am trying to listen to the chrome.webNavigation.onTabReplaced event, but the onTabReplaced event is never getting fired.

I am using Chrome version 30.0.1587.2 Canary (Windows 7).

Here is how my manifest file looks. Any help will be appreciated.

manifest.json:

{
  "manifest_version": 2,
  "name": "abcdef",
  "description": "abcdef",
  "version": "0.1",
  "permissions": [
         "tabs",
         "webNavigation",
         "background",
         "storage",
         "<all_urls>"
   ],
   "background": {
       "scripts": ["bg.js"]
   }
}

bg.js:

chrome.webNavigation.onTabReplaced.addListener(function (details) {
    // This event is not working in chrome.
    console.log('webNavigation.onTabReplaced-- old tab id: ' +details.replacedTabId +' new Tab Id ' + details.tabId);
});

Upvotes: 3

Views: 822

Answers (1)

Rob W
Rob W

Reputation: 348992

The onTabReplaced event is only fired when a prerendered tab is replaced. If you want to detect when a new document has loaded, use the chrome.webNavigation.onCommitted event.

Upvotes: 5

Related Questions