Right mouse button in webplayer

How can I use the right mouse button for interactivity in a web player, or get rid of the default right-mouse button context menu?

This came up recently on IRC, I thought it would be useful to have the answer archived here too.

This is possible. To do this you need to disable the context menu by editing the webplayer attributes in the HTML, as described here:

http://unity3d.com/support/documentation/Manual/WebPlayerBehaviorTags.html

Note! Be sure to read the bottom paragraph carefully - if you need to make any change, you have to make the same change n a number of different places within the HTML, in order to make it consistent for all browsers/platforms.

the unity web player has a property called disableContextMenu. you should set it to true in your HTML file or application. the HTML code is something like this.

if you edit the default HTML generated by unity has different sections for users with javascript enabled or not, you should edit both sections.

Here's a follow-on question -- I tried to apply this answer but without good success. You say in these answers "set it to true in your HTML file or application"... and here is my question:

  1. in the html file generated by unity, there is no instance of the string "disableContextMenu". Are you saying I must add this?

and more importantly....

  1. HOW DO I DO THIS FROM MY 'APPLICATION'?? (I'd much prefer to do it in code)