I have this code in background script of my Firefox WebExtension, but it prints : "OPENER ID: undefined"
each time new tab is created:
chrome.tabs.onCreated.addListener(function (tab) {
console.log("OPENER ID: " + tab.openerTabId);
});
What is the problem? This code works well in Chrome, and in documentation it says that openerTabId
property is supported in Firefox.
And yes, openerTab is still present when new tab is created (new tab is created by clicking on some link in openerTab).
Supported in Desktop Firefox as of Firefox 57
As of Firefox 57, the desktop version of Firefox supports
tabs.Tab.openerTabId
.Not supported in Firefox for Android
Firefox for Android does not support
tabs.Tab.openerTabId
For detail on a workaround which will give you at least some information, please see my answer to: How to get openerTabId in Firefox WebExtensions?
Not supported prior to Firefox 57 (original answer)
The problem is that Firefox does not support
tabs.Tab.openerTabId
. The compatibility notes for Firefox explicitly state [emphasis mine]:If you really need this information, you can, mostly, track it yourself using various events: How to get openerTabId in Firefox WebExtensions?
If this is functionality you desire to see as part of the WebExtensions API, I suggest you file a bug to track its implementation.