1
votes

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"); 
}
2

2 Answers

1
votes

Your approach is correct but the typeof operator gives you a string so you have to compare it to a string:

if (typeof ss.storage.firstRun == "undefined") {

This way it should work.