Can chrome.contextMenus.update be used to disable a menu item?

chrome extension context menu
chrome extension context menu submenu
chrome extension context menu get clicked element
chrome.contextmenus.onclicked.addlistener example
chrome extension context menu icon
chrome extension context menu selected text
chrome context menu css
chrome extension menu

I'm developing a Google Chrome extension that makes heavy use of the context menu, and I would like to make certain menu items available only on some domains.

Currently, I am using chrome.tabs.onUpdated and chrome.tabs.onSelectionChanged to check the tab url, and then I add or remove menu items based on a check against a domain list.

Is it possible to just disable the menu items, instead of removing them? I'm hoping for something like this:

chrome.contextMenus.update(id, {"disabled": true});

Unfortunately you cannot. That would be a neat feature I suppose. Feel free to submit a feature request http://crbug.com (Make sure you mention any valid use cases for it).

chrome.contextMenus, contextMenus API to add items to Google Chrome's context menu. You can Context menu items can appear in any document (or frame within a You must declare the "contextMenus" permission in your app's manifest to use the API. contextMenus.update(integer or string id, object updateProperties, function callback). I want to build a chrome extension that has a menu with some items based on what you click on. i use chrome.runtime.onConnectExternal to pass the date, everything works fine in here. but as the messaging between extension and site is done async some time the events come after the menu gets shown. and it dose not update after that.

An old post but maybe someone will find this answer useful.

As of Chrome 62 the following works (puts cleaner logic on large context menus): https://developer.chrome.com/apps/contextMenus#method-update

After the menu has been created, update the menu as follows:

chrome.contextMenus.update(intId-or-stringId, {"visible": true});

with toggle:

chrome.contextMenus.update(intId-or-stringId, {"visible": false});

Removing and creating menus will mess the order of the menu (new menus get placed at the bottom). Enabling and disabling still leaves the menu cluttered up. The visible option keeps the original order of the menu intact.

Context Menus - Google Chrome Extensions - Google , The context menus module allows you to add items to Google Chrome's context menu. appear in, specify the documentUrlPatterns field when you call the create() or update() method. When the context is 'selection', you can use %s within the string to show the selected text. The ID of the context menu item to remove. menus.remove() Removes a menu item. menus.removeAll() Removes all menu items added by this extension. menus.update() Updates a previously created menu item. Events menus.onClicked Fired when a menu item is clicked. menus.onHidden Fired when the browser hides a menu. menus.onShown Fired when the browser shows a menu. Browser compatibility

It's possible now: https://developer.chrome.com/extensions/contextMenus#property-createProperties-enabled

chrome.contextMenus.update('your-id', {
    enabled: false
});

Context Menus - Google Chrome Extensions, The context menus module allows you to add items to Google Chrome's context menu. You can choose When the context is 'selection', you can use %s within the string to show the selected text. For example, if Remove all context menu items added by this extension. Update a previously created context menu item. To manage context menu items, install CCleaner, open it from the Start menu, navigate to “Tools -> Startup,” and then select the tab “Context Menu.” Here, select the context menu item you want to disable, and click on the “Disable” button. If you want to completely delete the item, click on the “Delete” button.

Context Menu API Proposal, This will likely not be sufficient, since a frequent use case for context menus is to chrome.contextMenu.remove(id);. Removes an extension menu item with the update(int id, object properties) method so you can change your menu items in� In the Move Navigation Item sidebar, click the Place drop-down menu [1]. Select the placement of the navigation link you are moving [2]. You can move the link so it is located at the top of the list, before a specific navigation link, after a specific navigation link, or at the bottom of the list.

menus.create(), You can use " %s " in the string. If you do this in a menu item, and some text is selected in the page when the menu is shown, then the selected� Removing items from the Start menu is easy, so you can begin there. To remove an unwanted or unused tile from the Start menu, right-click it and choose Unpin from Start from the pop-up menu. The unloved tile slides away without fuss. On a touchscreen, hold down your finger on the unwanted tile.

chrome.contextMenus.create with dynamic items, I want to build a chrome extension that has a menu with some items based on what you click contextMenus.update(test, {title: 'menu ' + index++}) }, 1000); You can use the chrome.window API (documentation here). This function sets the show property of the appropriate element false to hide your DOM search result. As seen in the above example, after expanding the Data column, you can see the full file path value for the IntelliPoint program. C:\Program Files\Microsoft Mouse and Keyboard Center\ipoint.exe. In this example, "ipoint.exe" is the file name you would use in a search to identify its purpose on the computer.

Comments