contextMenus.OnClickData

Information sent when a context menu item is clicked.

Type

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

menuItemId
integer or string. The ID of the menu item that was clicked.
parentMenuItemIdOptional
integer or string. The parent ID, if any, for the item clicked.
mediaTypeOptional
string. One of "image", "video", or "audio" if the context menu was activated on one of these types of elements.
linkUrlOptional
string. If the element is a link, the URL it points to.
srcUrlOptional
string. Will be present for elements with a "src" URL.
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.
frameUrlOptional
string. The URL of the frame of the element where the context menu was clicked, if it was in a frame.
selectionTextOptional
string. If some text was selected in the page, this contains the selected text.
editable
boolean. A flag indicating whether the element is editable: for example, if it is a textarea.
wasCheckedOptional
boolean. A flag indicating whether a checkbox or radio item was checked before it was clicked.
checkedOptional
boolean. A flag indicating whether a checkbox or radio item was checked after it was clicked.

Browser compatibility

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

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,