Reputation: 5493
I know there is the openPopup
API to open a browserAction popup.
However, when it is open and a user e.g. selected something, can I somehow close it?
The same applies for a pageAction.
Cross-posted at Mozilla Discourse.
Upvotes: 2
Views: 766
Reputation: 5493
Actually, as for any other website a simple window.close();
works totally fine!
This was too simple.
Only tested in Firefox though.
Edit: As @juraj.masiar made me aware this won't work for Firefox for Android though:
You will have to use
browser.tabs.getCurrent().then(tab => browser.tabs.remove(tab.id))
. Plus you need to detect that you are running Android usingbrowser.runtime.getPlatformInfo()
function.
Upvotes: 3