WebExtensions : Creating tabs on Firefox Android

Hello, I am developping my first addon with WebExtensions API (available on AMO here and on GitHub here) and I am facing some issues with Firefox Android about creating tabs:

  1. In Android Firefox Nightly 57.0, in the browserAction popup when a user clicks on a button to open a new tab, the new tab is created but the popup closes and focus is given to the previous active tab (before openning popup). I have to use a setTimeout to focus again the new tab as below.

browser.tabs.create({url: "https://example.com", active: true},function(tab){
   if(android) setTimeout(function(){
      browser.tabs.update(tab.id,{active: true})
   },500);
});
  1. In Android Firefox all versions, API doesn’t provide any method to open a private tab. browser.tabs.create doesn’t accept incognito parameter and the only method is to use browser.windows as below which is not supported on Android.

browser.windows.create({url: "https://example.com", incognito: true});

How to force new tabs to be active from browserAction popup on Android ?
Is there any alternative method to create a private tab on Android ?

Seems like you found a pretty good workaround. Fennec is often somewhat buggy. BrowserActions have only just been added to it, just wait a few versions and the bugs will probably be fixed.

You can specify a cookieStoreId when opening tabs. Maybe you can use that to open private tabs.

Thank you for your reply. However, the value cookieStoreId is not supported in Firefox Android according to MDN.

Dammit. I guess that means all you can do is look for / file a bug.

Ok, I found exactly the same issue reported in bugzilla 4 months ago and there doesn’t seem to be any solution for the next versions of Firefox Android for now.

1 Like