MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

optional_permissions

Type Array
Mandatory No
Example

"optional_permissions": [
  "*://developer.mozilla.org/*",
  "webRequest"
]

Use the optional_permissions key to list permissions which you want to ask for at runtime, after your add-on has been installed.

While the permissions key lists permissions which you add-on needs if it is to be installed at all, optional_permissions lists permissions which your add-on doesn't need at install time, but which it might need to ask for at runtime at some point after it has been installed. To ask for a permission, use the permissions API. Asking for a permission will probably present the user with a dialog asking them to grant the permission to your add-on.

The key can contain two kinds of permissions:

  • host permissions: these are the same as the host permissions you can specify in the permissions key.
  • API permissions. You can include any of the following here, but not in all browsers: check the compatibility table for browser-specific details:
    • activeTab
    • background
    • bookmarks
    • clipboardRead
    • clipboardWrite
    • contentSettings
    • contextMenus
    • cookies
    • debugger
    • geolocation
    • history
    • idle
    • management
    • notifications
    • pageCapture
    • tabs
    • topSites
    • webNavigation
    • webRequest
    • webRequestBlocking

Note that this is a subset of the API permissions allowed in permissions.

Of this set, the following permissions are granted silently, without a user prompt: activeTab, cookies, idle, webRequest, webRequestBlocking.

Example

 "optional_permissions": ["*://developer.mozilla.org/*"]

Enable the add-on to ask for privileged access to pages under developer.mozilla.org.

  "optional_permissions": ["tabs"]

Enable the add-on to ask for access to the privileged pieces of the tabs API.

  "optional_permissions": ["*://developer.mozilla.org/*", "tabs"]

Enable the add-on to ask for both of the above permissions.

Browser compatibility

ChromeEdgeFirefoxFirefox for AndroidOpera
Basic supportYesNo5555Yes
bookmarksYesNo5555Yes
clipboardReadYesNo5555Yes
clipboardWriteYesNo5555Yes
cookiesYesNo5555Yes
historyYesNo5555Yes
idleYesNo5555Yes
notificationsYesNo5555Yes
tabsYesNo5555Yes
topSitesYesNo5555Yes
webNavigationYesNo5555Yes
webRequestYesNo5555Yes
webRequestBlockingYesNo5555Yes
backgroundYesNoNoNoYes
contentSettingsYesNoNoNoYes
contextMenusYesNoNoNoYes
debuggerYesNoNoNoYes
managementYesNoNoNoYes
pageCaptureYesNoNoNoYes
activeTabNoNo5555No
geolocationNoNo5555No

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,