Search code examples
javascriptfirefoxfirefox-addonfirefox-addon-sdk

Navigate to a website after installing my firefox extension


I'm using Firefox Add-On SDK 1.1 to build my extension and wondering how I can open a new tab just once after the user installs my extension?

This answer Opening my page in firefox after installing the addon doesn't really help since it's not working in Add-On SDK.


Solution

  • Sure it helps, all you have to do is use simple-storage instead of prefs and tabs.open instead of gBrowser.addTab:

    const tabs = require("tabs");
    const storage = require("simple-storage");
    
    if (storage.storage.first_run == undefined) {
        storage.storage.first_run = false;
        tabs.open("https://www.google.com");
    }