2
votes

I found how to show desktop notification with addon builder for firefox. Like in the below code, but how to show HTML custom notification, google chrome extension can show custom Html notification. Is that possible for Firefox, how?

Here's a typical example. When the message is clicked, a string is logged to the console.

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.
  }
});

This one displays an icon that's stored in the add-on's data directory. (See the self module documentation for more information.)

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

1 Answers

1
votes

It looks like you've found the current documentation:

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

As stated there, (sorry) HTML content in notifications is not supported in the Add-on SDK.