webNavigation.onTabReplaced
Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab.
Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab.
Syntax
browser.webNavigation.onTabReplaced.addListener(
listener, // function
filter // optional object
);
browser.webNavigation.onTabReplaced.removeListener(listener)
browser.webNavigation.onTabReplaced.hasListener(listener)
Events have three functions:
addListener(listener)- : Adds a listener to this event.
removeListener(listener)- : Stop listening to this event. The
listenerargument is the listener to remove. hasListener(listener)- : Check whether
listeneris registered for this event. Returnstrueif it is listening,falseotherwise.
addListener syntax
Parameters
listener- : The function called when this event occurs. The function is passed this argument:
details- :
object. Details about the tab replacement.replacedTabId- :
integer. The ID of the replaced tab. tabId- :
integer. The ID of the replacement tab. timeStamp- :
number. The time when the replacement happened, in milliseconds since the epoch.
Examples
function logOnTabReplaced(details) {
console.log(`onTabReplaced ${details}`);
}
browser.webNavigation.onTabReplaced.addListener(logOnTabReplaced);
Browser compatibility
[!NOTE] This API is based on Chromium's
chrome.webNavigationAPI. This documentation is derived fromweb_navigation.jsonin the Chromium code.