Sidebar for Firefox and Popup for Firefox for Android in a Single Plugin

Try this - don’t specify default_popup in the manifest file.
Then in your background script, detect Android platform: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/getPlatformInfo
And if it is Android, use setPopup to set the html you need.
And if it’s not Android, use the onClicked handler to open sidebar (well, if you are using Manifest V3, you’ll need to register the handler on top level and only inside the handler detect Android/Desktop and open the sidebar… aaaactually, that won’t work either, since opening a sidebar requires a user-action which is lost with the async call, so just open the sidebar in the callback :slight_smile: ).

I wish we had a “synchronous way” to detect Android :frowning:.

2 Likes