"commands" for android webextension?


What is the alternative if I want to trigger some action on the tab after clicking the extension icon on “menu > extensions > extension X”?

the “commands” key for manifest is not supported on android https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands#browser_compatibility

I could open a popup that have a single redundant button, or open the popup, do the things i need on the tab and close the popup. but that sounds like a lot of throw away work.

Does your extension currently use the action popup? If not, you can use browser.action.onClicked to detect when the action is clicked/tapped and use that to execute some logic on the page.

Unfortunately, beyond listening to that event there isn’t really a good way for a user to invoke an extension on Android. Another (IMO much worse) option is to inject a content script on pages you expect the user to interact with and add a button to the page to trigger the extension.