Firefox扩展没有显示图标 [英] Firefox extension not showing icons

查看:609
本文介绍了Firefox扩展没有显示图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了示例Mozilla Firefox扩展,在工具栏上显示Firefox图标(动作按钮),它会打开 http:/ / /www.mozilla.org/
在jpm运行中工作正常,然后我使用jpm xpi创建了一个包,并创建了xpi文件。然后我已经安装在我的Firefox浏览器,并成功安装,但没有工作。 无法在工具栏上添加firefox图标(动作按钮)(控制台中没有错误)。

以下是代码。 / p>

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,des cription:Sample AddOn,main:index.js,author:Sample,engines:{firefox:> = 30.0a1,fennec:> = 30.0a1},license:MIT}

b
$ b

我已经实现了使用 - https:// developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_%28jpm%29



请帮助。



感谢解决方案

为了使图标可见,您必须创建一个 data 在你的扩展中的目录,并把你的图标在那里。

I have implemented sample mozilla firefox extension to display firefox icon (action button) on toolbar and it will open "http://www.mozilla.org/". It is working fine in jpm run, then I have created package of that using jpm xpi and created xpi file. Then I have installed it in my firefox browser and successfully installed but did not work. It couldn't add firefox icon (action button) on toolbar (There is no error in console).

Below is the code.

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"
}

I have implemented that using - https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_%28jpm%29

Please Help.

Thanks

解决方案

In order to make the icons visable, you have to create a data directory inside your extension and put your icons there.

这篇关于Firefox扩展没有显示图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆