Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I trigger the browser context menu on an element. (As if the user right-clicked)

I have the need to trigger the opening of the browser (IE, Firefox, Safari, etc) context-menu via javascript. The problem I am trying to solve, is when an overlaid element is right-clicked, the element below it shows its context menu. So if the top element is a label, when you right click, I need to show the context menu for the input element below.

I know how to keep the label's context menu from showing, but I don't know how to open a context menu arbitrarily.

Any help is appreciated!

like image 367
Doug Neiner Avatar asked Aug 06 '09 21:08

Doug Neiner


1 Answers

Sorry to be the bearer of unfortunate news, but this is impossible to do with Javascript.

like image 61
Josh Stodola Avatar answered Sep 26 '22 11:09

Josh Stodola