Search code examples
firefoxfirefox-addonfirefox-addon-sdk

Firefox Add-on SDK open tab on first run


I am using the Firefox Add-on SDK, and I am attempting to open a tab as soon as my Firefox extension gets installed for the first time. The code below is in my main.js, but it doesn't seem to work. Any tips?

main.js:

var ss = require("simple-storage");
var tabs = require('tabs');

if (typeof(ss.storage.firstRun) === undefined) {
    ss.storage.firstRun = false;
    alert('First run');
    tabs.open("http://www.google.com"); 
}

Solution

  • Try using the load install reason: https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/load-and-unload.html