overrideContext

Jump to:

Hide all default Firefox menu items in favor of providing a custom context menu UI.

The overrideContext method will cause the matching menu items from this extension to be shown instead of the default menu. This method should be called from a 'contextmenu' DOM event handler, and only applies to the menu that opens after this event.

To call this method, your extension must have the menus.overrideContext permission.

Syntax

browser.menus.overrideContext(
  contextOptions // object
)

Parameters

contextOptions
object. Options for how the context menus will be overridden.
showDefaults Optional
boolean. Whether to also include default menu items in the menu.
context Optional
string. ContextType to override, to allow menu items from other extensions in the menu. Currently only 'bookmark' and 'tab' are supported. showDefaults cannot be used with this option.
bookmarkId Optional
string. Required when context is 'bookmark'. Requires 'bookmark' permission.
tabId Optional
integer. Required when context is 'tab'. Requires 'tabs' permission.
 

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, irenesmith
Last updated by: mdnwebdocs-bot,