安装 Firefox 扩展后打开页面

发布于 2024-11-24 08:47:55 字数 272 浏览 3 评论 0原文

我正在尝试做类似于这篇文章的事情。但是,我正在使用附加 SDK,但似乎找不到方法来执行此操作。

在用户安装我的附加组件后,我应该将用于打开页面的代码放在哪里?

另外,我想知道是否有一种方法可以在安装后切换附加栏,并在安装后在附加小部件顶部显示一个面板,就像 Chrome 在安装扩展后所做的那样。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

待"谢繁草 2024-12-01 08:47:55

这并不明显,但您可以附加在加载或卸载扩展时调用的函数。文档中的“简单扩展教程”对此进行了介绍:

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

认为要在一个模块,你可以做类似的事情:

var tabs = require("tabs");

exports.main = function (options, callbacks) {
    if (options.loadReason === 'install') {
        tabs.open("http://mozilla.org/");
    }
};

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/");
    }
};
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文