Detect a tab changed its container

Is there any way to detect that a tab was removed and then reopened in a container by Firefox Multi-Account Containers or other extensions? I’m developing an extension that groups tabs. It works correctly without containers - for example, users can open a new tab in the same group as the currently active tab. This is done using tab IDs. However, it breaks when containers are enabled, because when a user opens a website that is assigned to a container, this actually removes the tab and reopens it with a new ID. Is there any reliable way to detect that a tab was reopened in a container without user intervention? I could compare URLs and cookieStoreIds and keep track of that, but users might want to just open the same website in another tab (in another group), so I cannot really do that. Any advice?

Well, I can’t think of anything easy or stable, but what could help is to check how the “Multi-Account Containers” addon works:

So you could watch new tab being created and then old (active) being removed right away (let’s say within one second). That could be good enough :slight_smile: .

Maybe you can also use the “openerTabId” property to check if the new tab was created by the old one (it seems that the addon is setting it correctly).

1 Like

I hoped there was a more reliable way, but this is good enough. Thanks for the reply.

1 Like