Type | Array |
---|---|
Mandatory | No |
Example |
"permissions": [ "*://developer.mozilla.org/*", "webRequest" ] |
Use the permissions
key to request special powers for your extension. This key is an array of strings, and each string is a request for a permission.
If you request permissions using this key, then the browser may inform the user at install time that the extension is requesting certain privileges, and ask them to confirm that they are happy to grant these privileges. The browser may also allow the user to inspect an extension's privileges after installation. As the request to grant privileges may impact on users' willingness to install your extension, requesting privileges is worth careful consideration. For example, you want to avoid requesting unnecessary permissions and may want to provide information about why you are requesting permissions in your extension's store description. More information on the issues you should consider is provided in the article Request the right permissions.
For information on how to test and preview permission requests, see Test permission requests on the Extension Workshop site.
The key can contain three kinds of permissions:
- host permissions
- API permissions
- the activeTab permission
Host permissions
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:
- XMLHttpRequest and fetch access to those origins without cross-origin restrictions (even for requests made from content scripts)
- the ability to inject scripts programmatically (using tabs.executeScript) into pages served from those origins
- the ability to receive events from the webRequest API for these hosts
- the ability to access cookies for that host using the cookies API, as long as the "cookies" API permission is also included.
- bypass tracking protection if the host is a full domain without wildcards. Doesn't work with
<all_urls>
.
In Firefox, from version 56 onwards, extensions automatically get host permissions for their own origin, which is of the form:
moz-extension://60a20a9b-1ad4-af49-9b6c-c64c98c37920/
where 60a20a9b-1ad4-af49-9b6c-c64c98c37920
is the extension's internal ID. The extension can get this URL programmatically by calling extension.getURL():
browser.extension.getURL(""); // moz-extension://60a20a9b-1ad4-af49-9b6c-c64c98c37920/
API permissions
API permissions are specified as keywords, and each keyword names a WebExtension API that the extension would like to use.
The following keywords are currently available:
activeTab
alarms
background
bookmarks
browserSettings
browsingData
captivePortal
clipboardRead
clipboardWrite
contentSettings
contextMenus
contextualIdentities
cookies
debugger
dns
downloads
downloads.open
find
geolocation
history
identity
idle
management
menus
menus.overrideContext
nativeMessaging
notifications
pageCapture
pkcs11
privacy
proxy
search
sessions
storage
tabHide
tabs
theme
topSites
unlimitedStorage
webNavigation
webRequest
webRequestBlocking
In most cases the permission just grants access to the API, with the following exceptions:
tabs
gives you access to privileged parts of thetabs
API:Tab.url
,Tab.title
, andTab.faviconUrl
. In Firefox, you also needtabs
if you want to includeurl
in thequeryInfo
parameter totabs.query()
. The rest of thetabs
API can be used without requesting any permission.webRequestBlocking
enables you to use the "blocking" argument, so you can modify and cancel requests.downloads.open
lets you use thedownloads.open()
API.tabHide
lets you use thetabs.hide()
API.
activeTab permission
This permission is specified as "activeTab"
. If an extension has the activeTab
permission, then when the user interacts with the extension, the extension is granted extra privileges for the active tab only.
"User interaction" includes:
- the user clicks the extension's browser action or page action
- the user selects its context menu item
- the user activates a keyboard shortcut defined by the extension
The extra privileges are:
- the ability to inject JavaScript or CSS into the tab programmatically, using
browser.tabs.executeScript
andbrowser.tabs.insertCSS
- access to the privileged parts of the tabs API for the current tab:
Tab.url
,Tab.title
, andTab.faviconUrl
.
The intention of this permission is to enable extensions to fulfill a common use case, without having to give them very powerful permissions. Many extensions want to "do something to the current page when the user asks". For example, consider an extension that wants to run a script in the current page when the user clicks a browser action. If the activeTab
permission did not exist, the extension would need to ask for the host permission <all_urls>
. But this gives the extension more power than it needs: it could now execute scripts in any tab, any time it likes, instead of just the active tab and just in response to a user action.
Note that you can only get access to the tab/data that was there, when the user interaction occurred (e.g. the click). When the active tab navigates away, e.g. due to finishing loading or some other event, the permission does not grant you access to the tab anymore.
Usually the tab that's granted activeTab
is just the currently active tab, except in one case. The menus
API enables an extension to create a menu item which is shown if the user context-clicks on a tab (that is, on the element in the tabstrip that enables the user to switch from one tab to another). If the user clicks such an item, then the activeTab
permission is granted for the tab the user clicked, even if that's not the currently active tab (as of Firefox 63, bug 1446956).
Clipboard access
There are two permissions which enables the extension to interact with the clipboard:
clipboardWrite
: write to the clipboard usingClipboard.write()
,Clipboard.writeText()
,document.execCommand("copy")
ordocument.execCommand("cut")
clipboardRead
: read from the clipboard usingClipboard.read()
,Clipboard.readText()
ordocument.execCommand("paste")
See Interact with the clipboard for all the details on this.
Unlimited storage
The unlimitedStorage
permission:
- enables extensions to exceed any quota imposed by the
storage.local
API - in Firefox, enables extensions to create a "persistent" IndexedDB database, without the browser prompting the user for permission at the time the database is created.
Example
"permissions": ["*://developer.mozilla.org/*"]
Request privileged access to pages under developer.mozilla.org.
"permissions": ["tabs"]
Request access to the privileged pieces of the tabs
API.
"permissions": ["*://developer.mozilla.org/*", "tabs"]
Request both of the above permissions.
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | ||||
---|---|---|---|---|---|
permissions | Chrome Full support Yes | Edge Full support 14 | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
activeTab | Chrome Full support Yes | Edge No support No | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
alarms | Chrome Full support Yes | Edge No support No | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
background | Chrome Full support 10 | Edge No support No | Firefox No support No | Opera No support No | Firefox Android No support No |
bookmarks | Chrome Full support Yes | Edge Full support 15 | Firefox Full support 48 | Opera Full support Yes | Firefox Android No support No |
browserSettings | Chrome No support No | Edge No support No | Firefox Full support 56 | Opera No support No | Firefox Android Full support 56 |
browsingData | Chrome Full support Yes | Edge No support No | Firefox Full support 53 | Opera Full support Yes | Firefox Android Full support 56 |
clipboardRead | Chrome Full support Yes | Edge No support No | Firefox Full support 54 | Opera Full support Yes | Firefox Android Full support 54 |
clipboardWrite | Chrome Full support Yes | Edge No support No | Firefox Full support 51 | Opera Full support Yes | Firefox Android Full support 51 |
contentSettings | Chrome Full support Yes | Edge No support No | Firefox No support No | Opera Full support Yes | Firefox Android No support No |
contextMenus | Chrome Full support Yes | Edge Full support 14 | Firefox
Full support
55
| Opera Full support Yes | Firefox Android No support No |
contextualIdentities | Chrome No support No | Edge No support No | Firefox Full support 53 | Opera No support No | Firefox Android Full support 53 |
cookies | Chrome Full support Yes | Edge Full support 14 | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
debugger | Chrome Full support Yes | Edge No support No | Firefox No support No | Opera Full support Yes | Firefox Android No support No |
dns | Chrome No support No | Edge No support No | Firefox Full support 60 | Opera No support No | Firefox Android Full support 60 |
downloads | Chrome Full support Yes | Edge No support No | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
downloads.open | Chrome Full support Yes | Edge No support No | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
find | Chrome No support No | Edge No support No | Firefox Full support 57 | Opera No support No | Firefox Android No support No |
geolocation | Chrome Full support Yes | Edge Full support 14 | Firefox Full support 54 | Opera Full support Yes | Firefox Android Full support 54 |
history | Chrome Full support Yes | Edge No support No | Firefox Full support 49 | Opera Full support Yes | Firefox Android No support No |
identity | Chrome Full support Yes | Edge No support No | Firefox Full support 53 | Opera Full support Yes | Firefox Android No support No |
idle | Chrome Full support Yes | Edge Full support 15 | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
management | Chrome Full support Yes | Edge No support No | Firefox Full support 51 | Opera Full support Yes | Firefox Android Full support 51 |
menus | Chrome No support No | Edge No support No | Firefox Full support 53 | Opera No support No | Firefox Android No support No |
nativeMessaging | Chrome Full support 29 | Edge Full support 15 | Firefox Full support 50 | Opera Full support 16 | Firefox Android No support No |
notifications | Chrome Full support 5 | Edge No support No | Firefox Full support 48 | Opera Full support 25 | Firefox Android Full support 48 |
pageCapture | Chrome Full support Yes | Edge No support No | Firefox No support No | Opera Full support Yes | Firefox Android No support No |
pkcs11 | Chrome No support No | Edge No support No | Firefox Full support 58 | Opera No support No | Firefox Android No support No |
privacy | Chrome Full support Yes | Edge No support No | Firefox Full support 54 | Opera Full support Yes | Firefox Android Full support 54 |
proxy | Chrome Full support 33 | Edge No support No | Firefox Full support 55 | Opera No support No | Firefox Android Full support 55 |
search | Chrome No support No | Edge No support No | Firefox Full support 63 | Opera No support No | Firefox Android No support No |
sessions | Chrome Full support Yes | Edge No support No | Firefox Full support 52 | Opera Full support Yes | Firefox Android No support No |
storage | Chrome Full support Yes | Edge Full support 14 | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
tabs | Chrome Full support Yes | Edge Full support 14 | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 54 |
theme | Chrome No support No | Edge No support No | Firefox Full support 55 | Opera No support No | Firefox Android No support No |
topSites | Chrome Full support Yes | Edge No support No | Firefox Full support 52 | Opera Full support Yes | Firefox Android Full support 52 |
unlimitedStorage | Chrome Full support Yes | Edge Full support 14 | Firefox Full support 56 | Opera No support No | Firefox Android Full support 56 |
webNavigation | Chrome Full support Yes | Edge Full support 14 | Firefox Full support 48 | Opera Full support 17 | Firefox Android Full support 48 |
webRequest | Chrome Full support Yes | Edge Full support 14 | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
webRequestBlocking | Chrome Full support Yes | Edge Full support 14 | Firefox Full support 48 | Opera Full support Yes | Firefox Android Full support 48 |
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.
- See implementation notes.