如何编写我的加载项代码,以便Firefox知道在哪里检查更新?

时间:2012-04-27 14:21:04

标签: firefox-addon auto-update firefox-addon-sdk

我正在开发一个附加组件,我无法找到解释如何让Firefox知道在哪里查找更新的文档。如果我在我的网站上发布了.xpi并且用户下载并安装了.xpi,Firefox是否知道检查该URL是否有变化?或者我必须在package.json中添加一些内容吗?

1 个答案:

答案 0 :(得分:2)

您使用的是在线构建器还是SDK命令行工具?您只能使用cfx工具指定更新网址:

https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/cfx

在构建加载项时,您将使用以下参数运行cfx xpi

cfx xpi --update-link https://example.com/addon/latest
          --update-url https://example.com/addon/update_rdf

如果您已经使用构建器构建了加载项,那么hackier选项将是下载xpi,解压缩它,手动编辑install.rdf然后重新压缩它。有关install.rdf语法的文档,请参阅MDN:

https://developer.mozilla.org/en/Install_Manifests