安装Firefox扩展后打开一个页面 [英] Opening a page after Firefox extension install

查看:125
本文介绍了安装Firefox扩展后打开一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试做类似这个帖子。然而,我正在使用附加SDK,我似乎无法找到一种方法来做到这一点。

我将代码打开页面的权利在用户安装了我的插件后?



另外,我想知道是否有一种方法来切换安装后的加载项栏,并显示面板安装在我的附加组件之后,就像Chrome一样,在安装扩展之后就可以完成。

显而易见的,但是你可以附加在扩展加载或卸载时被调用的函数。这包括在文档中的简单扩展教程中:

https://developer.mozilla.org/zh-CN/Add-ons/SDK/Tutorials/Listening_for_load_and_unload



think 在模块中实现这个功能,你可以这样做:

  var tabs = require(tabs); 
$ b $ exports.main = function(options,callbacks){
if(options.loadReason ==='install'){
tabs.open(http:// mozilla .ORG /);
}
};


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.

解决方案

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

这篇关于安装Firefox扩展后打开一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆