Javascript Reference
Categories: oncontextmenu

javascript oncontextmenu Description

@April 12, 2008, 10:28 a.m.
oncontextmenu Firefox/Netscape/NN n/a IE 5(Win) Chrome/Safari/DOM n/a  


Bubbles: Yes; Cancelable: Yes  

Fires after the user clicks the right mouse button (or the button designated the secondary mouse button in the mouse control panel). This mouse button displays the context menu for the item beneath the pointer. To block the display of the context menu (and perhaps display a custom one of your own design via DHTML), set event.returnValue to false in the oncontextmenu event handler. While hiding the context menu may make it more difficult for users to view the source of a page or save an image (assuming you have already opened a document in a window bereft of the menubar), it is not a foolproof way to guard against determined users capturing your page's content. Any scripted solution fails the instant the user disables scripting.

Typical Targets

All rendered elements and the document object.

Powered by Linode.