[Javascript] No right click on images

Triche Osborne wdlists at triche-osborne.com
Thu Sep 15 07:19:28 CDT 2005


Alan Easton wrote:
> 
> I realise you cannot prevent your images being taken, all developers know it, 
> but it is basically a bit of "piece and mind" for the client. They feel 
> something like this enough of a deterent to the normal web user.
> 

Hi Alan,
	I know you've already said somewhere in this thready, though I can't 
recall where that in this case you were dealing with an extant site with 
lots of images. Given that, I can see why you might want something that 
doesn't take a lot of fuss to do, especially if all you're protecting is 
graphics. So . . . the following is offered only as an alternative for 
future reference:
	I have two clients who are commercial photographers. Both realize that 
you can't stop a determined thief, but both (understandably) wish to 
discourage casual swiping. Since I get really annoyed at disabled 
context menus--especially since you can turn off JS and disable the 
script--I've resorted to a non-JS solution that's a bit more complex but 
less intrusive.
	For each image display, I create a DIV the same size as the image with 
the photo as its background, then put a single-pixel transparent image 
stretched to exactly the same size within it. If the viewer right-clicks 
and tries to view or save the image, they get the transparent GIF, and 
since it exactly covers the background, they can't reach the background 
image to save or print it.
	As I said, this takes a bit more work, and I wouldn't bother unless I 
was building the site from scratch and the pictures are the source of 
income. I'm just throwing it out for an alternative. You never know when 
it may come in handy.

Triche




More information about the Javascript mailing list