使用Addon Builder Firefox进行Html桌面通知

时间:2013-04-06 14:42:05

标签: firefox firefox-addon firefox-addon-sdk

我找到了如何使用firefox的插件构建器显示桌面通知。如下面的代码,但如何显示HTML自定义通知,谷歌Chrome扩展可以显示自定义Html通知。这对Firefox有可能吗?

这是一个典型的例子。单击该消息时,会将一个字符串记录到控制台。

var notifications = require("notifications");
notifications.notify({
  title: "Jabberwocky",
  text: "'Twas brillig, and the slithy toves",
  data: "did gyre and gimble in the wabe",
  onClick: function (data) {
    console.log(data);
    // console.log(this.data) would produce the same result.
  }
});

此图标显示存储在附加组件数据目录中的图标。 (有关详细信息,请参阅自我模块文档。)

var notifications = require("notifications");
var self = require("self");
var myIconURL = self.data.url("myIcon.png");
notifications.notify({
  text: "I have an icon!",
  iconURL: myIconURL
});

1 个答案:

答案 0 :(得分:1)

您好像找到了当前的文档:

https://addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/sdk/notifications.html

如上所述,(抱歉)附加SDK中不支持通知中的HTML内容。

相关问题