Open tab in Mozilla Add On SDK

I am developing Mozilla Add on. I am trying to open a tab.

According to https://addons.mozilla.org/en-US/developers/docs/sdk/1.0/packages/addon-kit/docs/tabs.html this is done using

console.log("before tab");
var tabs = require("tabs");
tabs.open("http://www.example.com");

But he does not work on my case.

I do this in the content of the script. I have a page called popup.html and content called popup_script.js.

Code reached because message is logged.

Any idea?

+5
source share
1 answer

"" API, . script , . :

self.port.emit("openTab", "http://www.example.com");

main.js:

panel.port.on("openTab", function(url)
{
  var tabs = require("tabs");
  tabs.open(url);
});
+6

All Articles