Firefox Gets Unique Tab Identifier for Extension Development

I am developing a Firefox extension and I need to get and work with a unique tab identifier.

How can i do this?

Thank!

+3
source share
4 answers

If you use the Firefox SDK , you can get the id of the active tab using:

var tabs = require('sdk/tabs');
var activeTabId = tabs.activeTab.id;
+5
source

I have a solution. You can try this. The function below will return you the unique identifier of the current tab.

var get_current_tab_id = function()
        {
            var doc = gBrowser.contentDocument; //Gets the current document.
            var tab = null;
            var targetBrowserIndex = gBrowser.getBrowserIndexForDocument(doc);
            if (targetBrowserIndex != -1)
            tab = gBrowser.tabContainer.childNodes[targetBrowserIndex];
            else
            return(null);
            return(tab.linkedPanel);
        }
+3
source

If you mean that you want to interact with open firefox tabs in some way through javascript, then the answer is that you cannot.

+1
source

Source: https://habr.com/ru/post/1792099/


All Articles