files/en-us/mozilla/add-ons/webextensions/manifest.json/host_permissions/index.md
Use the host_permissions key to request access for the APIs in your extension that read or modify host data, such as {{WebExtAPIRef("cookies")}}, {{WebExtAPIRef("webRequest")}}, and {{WebExtAPIRef("tabs")}}. This key is an array of strings, and each string is a request for a permission.
Users can grant or revoke host permissions on an ad hoc basis. Therefore, most browsers treat host_permissions as optional.
On installation, when you request permissions using this key:
host_permissions and content_scripts are displayed in the install prompt. However, if an extension update requests new host permissions, these are not shown to the user. See (Firefox bug 1893232).Your extension can check whether it has all the required permissions immediately after installation using {{WebExtAPIRef("permissions.contains")}}. If it doesn't have the necessary permissions, it can request them using {{WebExtAPIRef("permissions.request")}}. Providing an onboarding step to explain why some permissions are necessary before requesting them might also be helpful.
As the request to grant host permissions may impact users' willingness to install your extension, requesting host permissions is worth careful consideration. For example, you want to avoid requesting unnecessary host permissions and may want to provide information about why you are requesting host permissions in your extension's store description. The article Request the right permissions provides more information on the issues you should consider.
For information on how to test and preview permission requests, see Test permission requests on the Extension Workshop site.
Host permissions are specified as match patterns, and each pattern identifies a group of URLs for which the extension is requesting extra privileges. For example, a host permission could be "*://developer.mozilla.org/*".
The extra privileges include:
url, title, and favIconUrl properties of {{WebExtAPIRef("tabs.Tab")}} objects."cookies" API permission is also included. "host_permissions": ["*://developer.mozilla.org/*"]
Request privileged access to pages under developer.mozilla.org.
{{Compat}}