如何连接Firefox插件选项按钮?

时间:2023-01-15 15:36:25

In Firefox, if you go to Tools -> Add-ons, in the list of extensions each one has an "Options" button. I would like to enable this for my extension and navigate the browser to a webpage where they can set options relating to my extension. The extension is an XPCOM extension, so if I can just register for a callback when the button is pressed, that would be ideal.

在Firefox中,如果您转到工具 - >附加组件,则在扩展列表中每个都有一个“选项”按钮。我想为我的扩展程序启用此功能,并将浏览器导航到一个网页,在该网页中他们可以设置与我的扩展程序相关的选项。扩展是一个XPCOM扩展,所以如果我可以在按下按钮时注册回调,那将是理想的。

Any advice is appreciated.

任何建议表示赞赏。

2 个解决方案

#1


The options (or preferences) button in the Firefox add-ons window is controlled by the <em:optionsURL/> tag (or the em:optionsURL attribute in <RDF:description/>) in the extension's install.rdf.

Firefox附加组件窗口中的选项(或首选项)按钮由扩展名install.rdf中的 标记(或 中的em:optionsURL属性)控制。

There is more information about em:optionsURL at developer.mozilla.org:

有关em:optionsURL的更多信息,请访问developer.mozilla.org:

https://developer.mozilla.org/en/Install_Manifests#optionsURL
https://developer.mozilla.org/en/Adding_preferences_to_an_extension

#2


install.rdf
......
<em:optionsType>3</em:optionsType>
<em:optionsURL>resource://@UserAgentChanger/options.htm</em:optionsURL>
......

#1


The options (or preferences) button in the Firefox add-ons window is controlled by the <em:optionsURL/> tag (or the em:optionsURL attribute in <RDF:description/>) in the extension's install.rdf.

Firefox附加组件窗口中的选项(或首选项)按钮由扩展名install.rdf中的 标记(或 中的em:optionsURL属性)控制。

There is more information about em:optionsURL at developer.mozilla.org:

有关em:optionsURL的更多信息,请访问developer.mozilla.org:

https://developer.mozilla.org/en/Install_Manifests#optionsURL
https://developer.mozilla.org/en/Adding_preferences_to_an_extension

#2


install.rdf
......
<em:optionsType>3</em:optionsType>
<em:optionsURL>resource://@UserAgentChanger/options.htm</em:optionsURL>
......