What's wrong with right click traps?

by Pinocchio Poppins

There are several EcmaScript snippets floating around to disable the context menu of web browsers that run on the Windows and UNIX systems. (EcmaScript is the language formerly known as JavaScript.) Web designers who use such scripts to "protect" their content are doing more harm than good.

why right-click traps don't work

why right click traps do harm

If the chosen EcmaScript snippet is smart enough to cover only images (such as the snippet below), it won't do much harm. However, most scripts disable the right-click menu everywhere, and this does more harm than good:

the bottom line

If you want to protect your images without getting in the way of navigation, use this snippet and only this snippet freely available from The JavaScript Source:

<script language="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source! http://javascript.internet.com/ -->
<!-- Toss this part between <head> and </head> -->

<!-- Begin
function right(e)
var msg = "Use the Print Screen key instead.";
if ((navigator.appName == 'Netscape' && e.which == 3) ||
    (navigator.appName == 'Microsoft Internet Explorer' &&
     event.button==2)) {
return false;
else return true;
function trap() {
for(i=0; i<document.images.length;i++)
document.images[i].onmousedown = right;
// End -->

Make sure to load it in the body tag: <body onLoad="trap()" bgcolor...>

A shit list

Shame on these sites for using right-click traps.:

(return to) abusive JavaScript