Søg i Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Firefox Add-On need to open an open dialog from the activeTab page

more options

Hi all,

i'm currently developing an add-on that has an import from file feature that needs to open an "Open file" dialog, now the problem is that in order to do that i had to do the following:

  • inject some javascript code in the active page as a content script
  • call the execute command from the extension to open the dialog popup (that is actually emulating a click)

I have to do it, because from an extension when a "File open" dialog appear, the extension lose the focus and it is automatically closed, and its context destroyed, so when i actually press open on the dialog, the "caller" is already gone (https://stackoverflow.com/questions/26884140/open-import-file-in-a-chrome-extension/26917671#26917671 you can refer to my stackoverflow question to get an idea of what i was doing)

This works fine in chrome (And it worked for a while on firefox) but probably in the latest months/years (not sure when it happened) it stopped working and when i press the import button nothing happens, after some investigation i found what is the problem: the "block popup" windows option enabled by default (i suppose it is enabled by default i don't remember to have never enabled it), so when i disable it, the feature resume working. What i'm wondering is if there is a way to programmatically add an exception to the popup blocker option while installing the extension, or if there is any way to avoid closing the exception popup when the "File Open" Dialog appears.

Thanks everyone

Hi all, i'm currently developing an add-on that has an import from file feature that needs to open an "Open file" dialog, now the problem is that in order to do that i had to do the following: * inject some javascript code in the active page as a content script * call the execute command from the extension to open the dialog popup (that is actually emulating a click) I have to do it, because from an extension when a "File open" dialog appear, the extension lose the focus and it is automatically closed, and its context destroyed, so when i actually press open on the dialog, the "caller" is already gone (https://stackoverflow.com/questions/26884140/open-import-file-in-a-chrome-extension/26917671#26917671 you can refer to my stackoverflow question to get an idea of what i was doing) This works fine in chrome (And it worked for a while on firefox) but probably in the latest months/years (not sure when it happened) it stopped working and when i press the import button nothing happens, after some investigation i found what is the problem: the "block popup" windows option enabled by default (i suppose it is enabled by default i don't remember to have never enabled it), so when i disable it, the feature resume working. What i'm wondering is if there is a way to programmatically add an exception to the popup blocker option while installing the extension, or if there is any way to avoid closing the exception popup when the "File Open" Dialog appears. Thanks everyone

Alle svar (2)

more options

Add-on questions should be posted in the add-ons forum; https://discourse.mozilla-community.org/c/add-ons

more options

You might need to switch from using a BrowserAction popup to using a page in a tab or a separate window (popup/panel), if suitable for your extension.