Can you create hidden tabs to maintain session state?

Hello!

I’d like to create context menu items for various links within a site but each time you jump to a link I want the page loaded in a tab so that the loading delay of each of these links is only experienced once. Basically, think of a site where I have 10 tabs open to various pages on that site - I’d prefer to have 1 tab but a context menu of “pages/tabs” that I can then select. Each page isn’t reloaded, which resets page state, instead it just shows that page just like switching tabs.

Thanks
-c

If your add-on is a WebExtension, then no, you can’t.

Otherwise you can get the XUL-Element that represents the tab in the tab bar (how this works depends on the context you are in) and set its hidden attribute.

If you have a SDK-add-on, something like this should work:

const { viewFor } = require('sdk/view/core');
const Tabs = require('sdk/tabs');

const tab = Tabs.open(...);

const xulTab = viewFor(tab);

tab.setAttribute('hidden', true); // hide

t.removeAttribute('hidden'); // show