optional_host_permissions

Type Array
Mandatory No
Manifest version 3 or higher
Example
json
"optional_host_permissions": [
  "*://developer.mozilla.org/*",
  "*://*.example.org/*"
]

Use the optional_host_permissions key to enable runtime requests for access (access granted by the user after your extension has been installed) for the APIs in your extension that read or modify host data, such as cookies, webRequest, and tabs. This key is an array of strings.

See host_permissions for more information on defining hosts.

Use the permissions API to request an optional host permission at runtime. Requesting a host permission may present the user with a dialog asking whether they want to grant the permission to your extension.

Note: Users may opt in or out of optional host permissions from the extension's Permissions tab in the Firefox Add-ons Manager. Extensions that use optional host permissions can check for the permissions granted by the user with permissions.getAll() and listen for permissions.onAdded and permissions.onRemoved to know when a user grants or revokes permissions.

Example

json
 "optional_host_permissions": ["*://developer.mozilla.org/*"]

Enables your extension to make a runtime request for privileged access to pages under developer.mozilla.org.

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
optional_host_permissions
Chrome – Full support
Chrome 102 (Release date: 2022-05-24)
footnote
footnote Available for use in Manifest V3 or later.
Edge – Full support
Edge 102 (Release date: 2022-05-31)
footnote
footnote Available for use in Manifest V3 or later.
Firefox – Full support
Firefox 128 (Release date: 2024-07-09)
footnote
footnote Available for use in Manifest V3 or later.
Opera – Full support
Opera 88 (Release date: 2022-06-08)
footnote
footnote Available for use in Manifest V3 or later.
Safari – Full support
Safari 15.5 (Release date: 2022-05-16)
footnote
footnote Available for use in Manifest V3 or later.
Firefox for Android – Full support
Firefox for Android 128 (Release date: 2024-07-09)
footnote
footnote Available for use in Manifest V3 or later.
Safari on iOS – Full support
Safari on iOS 15.5 (Release date: 2022-05-16)
footnote
footnote Available for use in Manifest V3 or later.

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.