user1670407
user1670407

Reputation:

Firefox extension content page

I am working on porting a chrome extension to a firefox extension.

The chrome extension has a "index.html" page that loads up in a tab when clicking the extension . Is this possible in a firefox extension?

Upvotes: 1

Views: 160

Answers (1)

Makyen
Makyen

Reputation: 33396

Assuming you are using the add-on SDK and adapting the tutorial that is available at Adding a Button to the Toolbar, the following should do what you have described.

var buttons = require('sdk/ui/button/action');
var tabs = require("sdk/tabs");

var button = buttons.ActionButton({
  id: "my-extension-index-button",
  label: "Open index.html",
  icon: {
    "16": "./icon-16.png",
    "32": "./icon-32.png",
    "64": "./icon-64.png"
  },
  onClick: handleClick
});

function handleClick(state) {
  tabs.open("index.html");
}

Upvotes: 2

Related Questions