搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

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

  • 2 回覆
  • 1 有這個問題
  • 14 次檢視
  • 最近回覆由 jscher2000

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

所有回覆 (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.

有幫助嗎?

問個問題

如果您還沒有帳號,您必須先 登入您的帳號 來回覆文章。請 開始一個新問題