menus.removeAll()

Removes all menu items added by the extension.

For compatibility with other browsers, Firefox makes this method available via the contextMenus namespace as well as the menus namespace.

This is an asynchronous function that returns a Promise.

Syntax

var removing = browser.menus.removeAll()

Parameters

None.

Return value

A Promise that will be fulfilled with no arguments when all items have been removed.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
Basic supportChrome Full support Yes
Alternate Name
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.removeAll
Edge Full support 14
Alternate Name
Full support 14
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.removeAll
Firefox Full support 55
Full support 55
Full support 48
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.removeAll
Opera Full support Yes
Alternate Name
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.removeAll
Firefox Android No support No

Legend

Full support  
Full support
No support  
No support
Uses a non-standard name.
Uses a non-standard name.

Examples

This example adds two menu items. When the user clicks the item labeled "Remove all!", the extension removes both items using removeAll().

function onRemoved() {
  console.log("items removed successfully");
}

browser.menus.create({
  id: "click-me",
  title: "Click me!",
  contexts: ["all"]
});

browser.menus.create({
  id: "remove-all",
  title: "Remove all!",
  contexts: ["all"]
});

browser.menus.onClicked.addListener(function(info, tab) {
  if (info.menuItemId == "remove-all") {
    var removing = browser.menus.removeAll();
    removing.then(onRemoved);
  }
});

Acknowledgements

This API is based on Chromium's chrome.contextMenus API. This documentation is derived from context_menus.json in the Chromium code.

Document Tags and Contributors

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