开发者

Opening a page after Firefox extension install

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 yo开发者_Go百科u install an extension.


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜