I’ve seen scripts that disable right-click menus of [URL=http://www.dynamicdrive.com/dynamicindex9/noright2.htm]images only[/URL] (so as not to annoy people who right-click on benign items), and I’ve seen scripts that disable right-click menus [URL=http://www.dynamicdrive.com/dynamicindex9/noright3.htm]silently[/URL] (so as not to annoy people with rude “Gotcha!” alert messages), but I’ve never seen scripts with both features. Is such a script possible?
@VladdyMay 07.2003 — #First, any scripts like that are a waste of time - there is not much you can do about Print Screen button and other Image Capturing programs. There are also other ways to go around "no right-click" scripts, like disabling javascript.
If you want an unintrusive way to prevent complete morons from copying your images, make a transparent gif and do this:
<div style="background: url(yourrealimage.gif); width=100px; height=100px;"><img src="transparent.gif" width="100" height="100"></div>
@pdxmitchauthorMay 07.2003 — #You can, in effect, disable the Print Screen function by replacing <body> with <body onload=setInterval("window.clipboardData.setData('text','')",20)> . I don't want to disable right-clicking for all of the page, just for the images, and I don't want a notice popping up, I just want nothing to happen. Is that possible?
@pdxmitchauthorMay 07.2003 — #Oh! I didn't understand KeshavaR's post fully -- you can target just one image or individual images by adding...
oncontextmenu="return false"
...to just the image tag! So <img src="copyrighted.jpg" oncontextmenu="return false"> disables right-clicking on that image only. That's brilliant! So much simpler than the javascript way. And no annoying pop-up messages!
@AdamGundryMay 07.2003 — #Only thing is, oncontextmenu is not valid HTML (it is IE-specific) and will fail if Javascript is disabled in the user's browser. Vladdy's method is more reliable, as it does not depend on JS.
Finally, though, the only way to truly protect your images is not to put them online in the first place.