Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/menus/remove/index.md
6567 views
------{{AddonSidebar()}}
Removes a menu item.
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
Parameters
menuItemId:
integerorstring. The ID of the menu item to remove.
Return value
A Promise that will be fulfilled with no arguments if removal was successful, or rejected with an error message if removal failed (for example, because the item could not be found).
Examples
This extension adds a menu item labeled "Remove me!". If you click the item, the extension removes it.
{{WebExtExamples}}
Browser compatibility
{{Compat}}
Note: This API is based on Chromium's
chrome.contextMenusAPI. This documentation is derived fromcontext_menus.jsonin the Chromium code.