Reputation: 323
This is something like simulating the mouse right click to a keyboard key in javascript so as to obtain the context menu and navigate through it to launch the console(Inspect Element).
What i am able to do is.. I can simulate the right click event but it does not generate the context menu on the keypress. When mouse right click is used, it shows the event phase as the bubbling phase whereas on the keypress it shows the event phase as the target phase. Can someone throw any light on this??
Upvotes: 0
Views: 1263
Reputation: 147403
What you really want to do is call a function that initiates the (Firebug?) inspect element function. There is no standard javascript function to access the context menu, nor does it seem like a good idea for browsers to allow scripts in web pages access to it, though it might be an extension available in specific browsers for enterprise or controlled environment applications.
For completeness, you can dispatch a click event into the DOM with parameters to emulate a right mouse button click, but that will not open the context menu.
Upvotes: 1