FF Addon SDK是否有API可以打开设置页面? [英] Has FF Addon SDK an API to open settings page?
本文介绍了FF Addon SDK是否有API可以打开设置页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用简单偏好用于配置插件设置的模块.如何 以编程方式 打开插件的设置页面?
I use simple-prefs module to configure addon settings. How can I programmatically open addon's settings page?
推荐答案
There is more code there than you need though, so the shorter version is:
const self = require('sdk/self');
const tabs = require('sdk/tabs');
tabs.open({
url: 'about:addons',
onReady: function(tab) {
tab.attach({
contentScriptWhen: 'end',
contentScript: 'AddonManager.getAddonByID("' + self.id + '", function(aAddon) {\n' +
'unsafeWindow.gViewController.commands.cmd_showItemDetails.doCommand(aAddon, true);\n' +
'});\n'
});
}
});
换句话说,这将在新选项卡中打开about:addons
页面,等待其加载,然后打开加载项的详细信息页面.
In words, this opens the about:addons
page in a new tab, waits for it to load, then opens the details page for your add-on.
这篇关于FF Addon SDK是否有API可以打开设置页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文