jim.shamlin.com

Context Menu Override

A quickie ... if you should want or need to override the context menu that appears on right-click of a Web page, just do this:

<body oncontextmenu="return false;">

I've done this on the present page - go ahead and right-click. Nothing happens.

Utility

I've used this a few times when developing an JavaScript application in which I wanted to enable a right-click menu and didn't want the browser's built-in menu getting in the way. In retrospect, that was probably not a very good idea. No reason I shouldn't have just used a normal (left) click to launch the menu, and it may be confusing to the user.

I've seen some references where it was claimed to be a way to prevent users from printing out a page, stealing the graphics, prevent the user from navigating backward, etc. But that's just a jerk-hurdle.