Updates a previously created context menu item.

This is an asynchronous function that returns a Promise.


var updating = browser.contextMenus.update(
  id,               // integer or string
  updateProperties // object


integer or string. The ID of the item to update.
object. The properties to update. Accepts the same values as create().
contextMenus.ItemType. The type of menu item: "normal", "checkbox", "radio", "separator". Defaults to "normal".
string. The text to be displayed in the item; this is mandatory unless type is "separator".
boolean. The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items.
array of contextMenus.ContextType. Array of contexts in which this menu item will appear. Defaults to ['page'] if not specified.
function. A function that will be called when the menu item is clicked. Event pages cannot use this: instead, they should register a listener for contextMenus.onClicked.
integer or string.  The ID of a parent menu item; this makes the item a child of a previously added item. Note: You cannot change an item to be a child of one of its own descendants.
array of string. Lets you restrict the item to apply only to documents whose URL matches one of the given match patterns. This applies to frames as well.
array of string. Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags.
boolean. Whether this context menu item is enabled or disabled. Defaults to true.

Return value

A Promise that will be fulfilled with no arguments if the update was successful, or rejected with an error message if the update failed.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes Yes 48.0 No 33

Compatibility notes


  • documentUrlPatterns is supported from Firefox 50.


This example creates a context menu item, then updates its title when the user clicks it:

function onUpdated() {
  console.log("item updated successfully");

function onError() {
  console.log("error updating item:" + browser.runtime.lastError);

  id: "do-not-click-me",
  title: "Do not click this button",
  contexts: ["all"]

browser.contextMenus.onClicked.addListener(function(info, tab) {
  if (info.menuItemId == "do-not-click-me") {
    var updating = browser.contextMenus.update(info.menuItemId, {
      title: "Do not click this button again"
    updating.then(onUpdated, onError);

Example add-ons


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

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

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