【发布时间】:2016-01-01 16:42:02
【问题描述】:
我已经实现了示例 mozilla firefox 扩展以在工具栏上显示 firefox 图标(操作按钮),它将打开“http://www.mozilla.org/”。 它在 jpm run 中运行良好,然后我使用 jpm xpi 创建了它的包并创建了 xpi 文件。然后我将它安装在我的firefox浏览器中并成功安装但没有工作。 无法在工具栏上添加firefox图标(操作按钮)(控制台没有错误)。
下面是代码。
index.js
var buttons = require('sdk/ui/button/action');
var tabs = require("sdk/tabs");
var button = buttons.ActionButton({
id: "mozilla-link",
label: "Visit Mozilla",
icon: {
"16": "./icon-16.png",
"32": "./icon-32.png",
"64": "./icon-64.png"
},
onClick: handleClick
});
function handleClick(state) {
tabs.open("http://www.mozilla.org/");
}
package.json
{
"title": "Sample",
"name": "sample",
"version": "0.0.1",
"description": "Sample AddOn",
"main": "index.js",
"author": "Sample",
"engines": {
"firefox": ">=30.0a1",
"fennec": ">=30.0a1"
},
"license": "MIT"
}
我已经使用-https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_%28jpm%29实现了这一点
请帮忙。
谢谢
【问题讨论】:
-
您使用的配置文件是否设置为从不记住历史记录(选项 -> 隐私 -> 历史记录),或者在 private browsing mode 中设置。如果是这样,请参阅Firefox add-on works with “jpm run”, but not whith .xpi file generated with “jpm xpi”。
标签: firefox firefox-addon firefox-addon-sdk firefox-developer-tools