I have a Reload All Tabs command for the tab context menu. For any tabs that are currently playing media (tab.audible == true) I’d like to offer the user a confirm dialog. At a minimum, it would have Yes and No buttons, but it also could have Alway, Never, or a Do this every time checkbox.
I’m having trouble finding a nice way to present that. What doesn’t seem to work is:
-
window.confirm() – it doesn’t seem to be available in background scripts (e.g., https://stackoverflow.com/questions/53213329/what-to-replace-the-window-confirm-function-in-webextensions-from-background-pag ); I am trying to avoid requiring host permissions
-
openpopup() associated with my browser action – ignored without error; the call may be too remote from the user action, since it is in the function called by the listener instead of in the listener itself?
-
notification API – Firefox doesn’t support buttons in notifications, so this is out
That leaves creating a new window, which could be annoying, but is the only thing I still see as an option. Any other ideas?
(https://github.com/jscher2000/switch-to-previous-active-tab/blob/master/background.js#L630)