Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
});
like image 693
apdev Avatar asked Jan 25 '26 19:01

apdev


1 Answers

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.

like image 101
Rob W Avatar answered Jan 28 '26 22:01

Rob W