disable right click on webpage...

Soldato
Joined
1 Feb 2006
Posts
8,188
... i know this is terrible bad design practice but doing up a site for a photography site here and the guy wants to know about having the right click disabled. I have some code which does it but what I need to know is can i just disable the right click when the mouse is rolled over the images? Ideally the user should have the right click menu available to add bookmarks, go back etc etc but if I could disable right click over images only it might be a more viable solution. Any suggestions?
 
You should be able to find one with a google search. I found a couple but they only worked in IE.

I think your best bet would be to just watermark the images (anyone who could figure out how to crop around or remove a watermark would certainly be capable of getting around a no right click script).

You could also display the image as a transparent .gif and put the real image in as a background. Anyone right clicking and saving would just get the .gif. Once again, anyone with half a brain would simply view source.

As you said though, it is bad practice. Even worse, it will make him look unprofessional and untrusting. Not the type of person I would want to deal with if I were looking for a photographer.
 
I think watermarks are the best bet too, a lot more professional. Disabling right-click doesn't do anything to protect the images, I think you would be best explaining this to the guy the site is for because he is obviously under the impression it offers some sort of protection. There are loads of way around it, disabling javascript, using the 'menu' key, using the browser menu etc.
 
Last edited:
try this

Code:
<body oncontextmenu="return false;">

should stop right click on both FF and IE

obviously that stops all right clicking
 
thanks for all the info guys - all the photos will be watermarked so disabling the right click was just an option for some more 'protection'. That simple viewer is a really nice job
 
Back
Top Bottom