4

I am trying to do something similar to this post. However, I am using the Add-on SDK and I can't seem to find a way to do this.

Where would I put the code to open the page right after the user has installed my add-on?

Also, I would like to know if there is a way to toggle the add-on bar after installation, and show a panel on top of my add-on widget after installation like Chrome does it after you install an extension.

Community
  • 1
  • 1
Robert
  • 41
  • 1

1 Answers1

5

It isn't obvious, but you can attach functions that get called when the extensions is loaded or unloaded. This is covered in the 'simple extension tutorial' in the docs:

https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Listening_for_load_and_unload

I think to implement this in a module you could do something like:

var tabs = require("tabs");

exports.main = function (options, callbacks) {
    if (options.loadReason === 'install') {
        tabs.open("http://mozilla.org/");
    }
};
Sina
  • 607
  • 7
  • 22
therealjeffg
  • 5,790
  • 1
  • 23
  • 24