Never mind, I found out
You can use an event listener for "contextmenu" to determine the element in a content script:
Code:window.addEventListener('contextmenu', function(event) { myelement = event.target; }, false);
This is a discussion on Context menu for editable items within the Plugins Development section, part of the Chrome Plugins category: Hi everyone, I am developing a small extension that adds a context menu to "editable" items on pages. This works ...
Hi everyone,
I am developing a small extension that adds a context menu to "editable" items on pages. This works quite well. But after hours of intense research I was not able to find out which page element the context menu had been activated from.
Example: There are text boxes on a page. When I right click on one of the text boxes I get my context menu. In the "onclick" callback of the context menu I want to detect which text box I clicked on ... how can I do that?
Thomas
Never mind, I found out
You can use an event listener for "contextmenu" to determine the element in a content script:
Code:window.addEventListener('contextmenu', function(event) { myelement = event.target; }, false);
Thanks for coming back and sharing that with us, great workaround for the problem, works great.