I've found a lot of questions like this one, this one, and this one, purporting to show how to "simulate a right click" or "trigger the context menu", etc. Then I found this one, which simply says it can't be done. I think the first 3 questions are all triggering custom context menus, i.e. menus that are attached to replace the built-in one. I'd like to just simulate a user right-click on a particular element of my choice.
I've tried all the suggestions in the first questions -- varying combinations of createEvent("MouseEvents" / "HTMLEvents")
and initEvent / initMouseEvent("click" / "contextmenu")
, jQuery's trigger
, etc. Nothing makes the default context menu appear.
Is it truly impossible? Does the fact that I'm running "privileged" from a userscript (in Greasemonkey) make any difference? Could I do it from a full-weight Firefox extension?