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