browser_specific_settings 编辑

TypeObject
MandatoryUsually, no (but see also When do you need an Add-on ID?). Mandatory before Firefox 48 (desktop) and Firefox for Android.
Example
"browser_specific_settings": {
  "gecko": {
    "id": "addon@example.com",
    "strict_min_version": "42.0"
  }
}

Description

The browser_specific_settings key contains keys that are specific to a particular host application.

Firefox (Gecko) properties

Firefox stores is browser specific settings in the gecko subkey, which has the following properties:

id
Is the extension ID. Optional from Firefox 48, mandatory before Firefox 48. See Extensions and the Add-on ID to see when you need to specify an add-on ID.
strict_min_version
Minimum version of Gecko to support. Versions containing a "*" are not valid in this field. Defaults to "42a1".
strict_max_version
Maximum version of Gecko to support. If the Firefox version on which the extension is being installed or run is above this version, then the extension will be disabled, or not permitted to be installed. Defaults to "*", which disables checking for a maximum version.
update_url
Is a link to an extension update manifest. Note that the link must begin with "https". This key is for managing extension updates yourself (i.e. not through AMO).

See the list of valid Gecko versions.

Extension ID format

The extension ID must be one of the following:

  • GUID
  • A string formatted like an email address: extensionname@example.org

The latter format is easier to generate and manipulate. Be aware that using a real email address here may attract spam.

For example:

"id": "extensionname@example.org"
"id": "{daf44bf7-a45e-4450-979c-91cf07434c3d}"

Microsoft Edge properties

Warning: Adding Edge-specific properties to the manifest caused an error prior to Firefox 69 which can prevent the extension from installing.

Microsoft Edge stores its browser specific settings in the edge subkey, which has the following properties:

browser_action_next_to_addressbar

Boolean property which controls the placement of the browser action.

Safari properties

Warning: Adding Safari-specific properties to the manifest caused an error prior to Firefox 69 which can prevent the extension from installing.

Safari stores its browser specific settings in the safari subkey, which has the following properties:

strict_min_version
Minimum version of Safari to support.
strict_max_version
Maximum version of Safari to support.

Examples

Example with all possible keys. Note that most extensions will omit strict_max_version and update_url.

"browser_specific_settings": {
  "gecko": {
    "id": "addon@example.com",
    "strict_min_version": "42.0",
    "strict_max_version": "50.*",
    "update_url": "https://example.com/updates.json"
  },
  "edge": {
    "browser_action_next_to_addressbar": true
  },
  "safari": {
    "strict_min_version": "14",
    "strict_max_version": "20"
  }
}

Browser compatibility

BCD tables only load in the browser

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:88 次

字数:5959

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文