menus.OnClickData

Information passed to the menus.onClicked event listener when a menu item is clicked.

Type

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

bookmarkId Optional
string. The ID of the bookmark where the context menu was clicked.
checked Optional
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.
frameId Optional
integer. The ID of the frame in which the item was clicked. The frame ID can be used in other APIs that accept frame IDs, such as tabs.sendMessage(). If the item was clicked in the top level document, frameId is zero. If the item was clicked outside the page entirely (for example, in the tools_menu or tab context), then frameId is undefined.
frameUrl Optional
string. The URL of the frame of the element where the context menu was clicked, if it was in a frame.
linkText Optional
string. If the element is a link, the text for the link. If the link contains no text, the URL itself is given here.
linkUrl Optional
string. If the element is a link, the URL it points to.
mediaType Optional
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: "Alt", "Command", "Ctrl", "MacCtrl", and "Shift". On a Mac, if the user has the Control key pressed, then both "Ctrl" and "MacCtrl" are included.
pageUrl Optional
string. The URL of the page in which the menu item was clicked. This property is not present if the click occurred in a context where there is no current page, such as on a browser action.
parentMenuItemId Optional
integer or string. The parent ID, if any, for the item clicked.
selectionText Optional
string. If some text was selected in the page, this contains the selected text.
srcUrl Optional
string. Will be present for elements with a "src" URL.
targetElementIdOptional
integer. An identifier of the clicked element, if any. Use menus.getTargetElement() in the page to find the corresponding element.
wasChecked Optional
boolean. A flag indicating whether a checkbox or radio item was checked before it was clicked.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
Basic supportChrome Full support Yes
Alternate Name
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.OnClickData
Edge Full support 14
Alternate Name
Full support 14
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.OnClickData
Firefox Full support 55
Full support 55
Full support 48
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.OnClickData
Opera Full support Yes
Alternate Name
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.OnClickData
Firefox Android No support No
bookmarkIdChrome No support NoEdge No support NoFirefox Full support 59Opera No support NoFirefox Android No support No
frameIdChrome Full support 35
Alternate Name
Full support 35
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.OnClickData.frameId
Edge ? Firefox Full support 55Opera Full support Yes
Alternate Name
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: contextMenus.OnClickData.frameId
Firefox Android No support No
linkTextChrome No support NoEdge No support NoFirefox Full support 56Opera No support NoFirefox Android No support No
modifiersChrome No support NoEdge No support NoFirefox Full support 54Opera No support NoFirefox Android No support No

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Uses a non-standard name.
Uses a non-standard name.

Acknowledgements

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

Document Tags and Contributors

Contributors to this page: ExE-Boss, kernp, Kwan, Brettz9, wbamberg, ntim
Last updated by: ExE-Boss,