Javascript – capture right click through Javascript, withouth wmode

flashjavascriptlocalizationright-clickswfobject

Flash player has a bug in using anything other than wmode="window" in Firefox/Chrome when using any other language than English. This bug is reported and not fixed yet

http://bugs.adobe.com/jira/browse/FP-501

The issue can be seen better here –

http://www.5etdemi.com/blog/archives/2005/06/firefox-wmodetransparent-is-completely-screwy-and-breaks-textfields/

Now to my problem – im trying to use Uza's right click solution ( http://www.uza.lt/blog/2007/08/solved-right-click-in-as3 ) in my application, but am stuck with problem of wmode. The event capturing doesnt seem to work with wmode="window" and i need multiple languages to work on my app as well.

Is there any solution to this that anyone has identified? Or is there any way that the right click can be captured without setting wmode.

Any help will be greatly appreciated. Thanks!!

Best Answer

Fortunately you most often want to know if the right button has been clicked. Since W3C and Microsoft happen to agree on this one and give button a value of 2, you can still detect a right click.

function doSomething(e) {
    var rightclick;
    if (!e) var e = window.event;
    if (e.which) rightclick = (e.which == 3);
    else if (e.button) rightclick = (e.button == 2);
    alert('Rightclick: ' + rightclick); // true or false
}

http://www.rgagnon.com/jsdetails/js-0061.html

http://www.quirksmode.org/js/events_properties.html

http://unixpapa.com/js/mouse.html http://www.javascripter.net/faq/leftvsri.htm