permissions.remove()

Revokes the permissions listed in a permissions.Permissions object.

Permissions must come from those defined in the extension's optional_permissions key or gecko.data_collection_permissions.optional property of the browser_specific_settings key of its manifest.json file.

Syntax

js
let removing = browser.permissions.remove(
  permissions                // Permissions object
)

Parameters

permissions

A permissions.Permissions object.

Return value

A Promise fulfilled with true if the browser is no longer granting the permissions listed in the permissions argument to the extension, or false otherwise.

Examples

This code adds a click handler that removes a permission.

js
const permissionToRemove = {
  permissions: ["history"],
};

async function remove() {
  console.log("removing");
  const removed = await browser.permissions.remove(permissionToRemove);
  console.log(removed);
}

document.querySelector("#remove").addEventListener("click", remove);

Example extensions

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
remove
Chrome – Full support
Chrome 16 (Release date: 2011-12-13)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 55 (Release date: 2017-08-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote
footnote Removing <all_urls> or *://*/* origins will remove previously granted permission to request specific origin patterns and will stop automatically prompting the user for access to any visited website via the extension's access popover in the toolbar.
Firefox for Android – Full support
Firefox for Android 79 (Release date: 2020-07-28)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote
footnote Removing <all_urls> or *://*/* origins will remove previously granted permission to request specific origin patterns and will stop automatically prompting the user for access to any visited website via the extension's access popover in the toolbar.

Legend

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

Full support
Full support
See implementation notes.

Note: This API is based on Chromium's chrome.permissions API.