Firefox扩展安装

时间:2023-03-08 17:36:00
Firefox扩展安装

firefox扩展和chrome扩展非常相似,甚至兼容。因总结过chrome扩展的开发,这里不提,本篇谈谈firefox扩展的安装。

1、打包

所谓的打包,就是压缩,利用普通的右键压缩文件夹,这样形成的zip包,没法签名。firefox的打包可以用命令:web-ext  build。要执行此命令,必须安装web-ext,它是基于node.js的。所以首先得安装node.js。可参考文章: Getting started with web-ext

2、签名

upload your add-on through the Developer Hub on AMO  上传压缩包到开发中心进行签名。当然,签名还有其它两种方式,我觉得比较麻烦。可参考文章:Signing and distributing your add-on

3、分发

签名后会生成一个后缀名为xpi的文件。

  • Direct the user to install from addons.mozilla.org (AMO) by offering a link.
  • Sideloading.
  • Using the Windows registry.

有三种安装方式:

a、把xpi文件上传到官方的插件中心,然后给用户提供一个连接。

b、xpi文件下载到本地后,从浏览器安装。打开扩展列表,如下图所示:

Firefox扩展安装

还有一种方式,就是把文件重命名为插件的Id,然后放到插件加载的默认位置,浏览器重启后即可加载。可参考:Sideloading add-ons

c、用注册表

For all users of the computer, add to the following registry keys:

  HKEY_LOCAL_MACHINE\Software\Mozilla\Firefox\Extensions

   or

  HKEY_LOCAL_MACHINE\Software\Wow6432Node\Mozilla\Firefox\Extensions

然后创建项,名称为插件Id,如borderify@example.com,值为路径,如 c:/webext/borderify@example.com.xpi

可参考:Add-ons in the enterprise