contextMenus.OnClickData

Information sent when a context menu item is clicked.

Type

Values of this type are objects. They contain the following properties:

checkedOptional
boolean. A flag indicating whether a checkbox or radio item was checked after it was clicked.
editable
boolean. A flag indicating whether the element is editable: for example, if it is a textarea.
frameUrlOptional
string. The URL of the frame of the element where the context menu was clicked, if it was in a frame.
linkUrlOptional
string. If the element is a link, the URL it points to.
mediaTypeOptional
string. One of "image", "video", or "audio" if the context menu was activated on one of these types of elements.
menuItemId
integer or string. The ID of the menu item that was clicked.
modifiers
Array of string. An array containing any modifier keys that were pressed when the item was clicked. Possible values are: "Command", "Ctrl", "MacCtrl", and "Shift". On a Mac, if the user has the Control key pressed, then both "Ctrl" and "MacCtrl" are included.
pageUrlOptional
string. The URL of the page in which the menu item was clicked. This property is not present if the click occured in a context where there is no current page, such as on a browser action.
parentMenuItemIdOptional
integer or string. The parent ID, if any, for the item clicked.
selectionTextOptional
string. If some text was selected in the page, this contains the selected text.
srcUrlOptional
string. Will be present for elements with a "src" URL.
wasCheckedOptional
boolean. A flag indicating whether a checkbox or radio item was checked before it was clicked.

Browser compatibility

ChromeEdgeFirefoxFirefox for AndroidOpera
Basic supportYesYes48NoYes
modifiersNoNo54NoNo

Acknowledgements

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
 Last updated by: wbamberg,