PDA

View Full Version : Disable right click on Lighbox images



kunwarbs
01-10-2008, 09:40 AM
1) Script Title: Lightbox

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm

3) Describe problem: How can I disable right click on Lightbox images?

jscheuer1
01-10-2008, 12:48 PM
Don't bother. Even if you could, which you can't reliably across browsers, the images could still be copied - I'm assuming that's what you are trying to prevent.

To stop your images from being copied, you must never publish them. However, if it is really just the matter of infringement that concerns you, publish away! Your images are protected by copyright.

kunwarbs
01-11-2008, 09:44 AM
I am not bothered about copyright but the privacy of my website users. I have a regional matrimonial website wherein users can publish their profile with photos. The users are concerned about their photos being easily accessible to everyone.

I understand that even disabling r/click will not protect from photo theft but it would atleast minimize that.

rafeekmca
01-11-2008, 10:21 AM
Hi Kumwarbs,

you can able to do this by disabling the right key selection for only selected browser but i always the image was copied in some way. But try this Javascript code it will disable the right selection options for IE.
onselectstart="return false"
var message="Right-mouse click has been disabled.";
<script language=JavaScript>
<!--
var message="This text is copyrighted by Vanderhoof, LLC";
function click(e)
{
if (document.all)
{
if (event.button==2||event.button==3)
{
alert(message);
return false;
}
}
else
{
if (e.button==2||e.button==3)
{
e.preventDefault();
e.stopPropagation();
alert(message);
return false;
}
}
if (e.which)
{
alert("oops Opera?")
}
}

if (document.all) // for IE
{
document.onmousedown=click;
}
else // for FF
{
document.onclick=click;
}
// -->
</script>

codeexploiter
01-11-2008, 12:06 PM
Even if you have a perfectly working no-right click code (which is not possible now as John mentioned) they can copy your images using lots of other means like screenshot takers, saving the page, etc..

Once you put it in the site public can access these items without much trouble.

jscheuer1
01-11-2008, 04:08 PM
slimbox:

http://www.digitalia.be/software/slimbox

is a lightbox clone where the larger images displayed are background images behind transparent elements. That would effectively cut down greatly, if not completely on right clicking for image copying.

But the images can easily be gotten via other means. You cannot both show someone's images and protect someone's privacy as regards them. To pretend to do so by disabling right click in this or any other manner would be more of a violation of those who are trusting you with their images than the actual taking of those images by others would be.