Disabling Right Click on Pictures Disabling Right Click on Pictures
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Disabling Right Click on Pictures

Started by marcamillion, June 17, 2004, 09:59:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

marcamillion

I want to disable users from being able to dload or save the pictures in my gallery. One thing that came to mind was to disable right click. How do I do that ?

Joachim Müller

search this board, this has been asked a thousand times. Thanks.

GauGau

bit bit spears

Add this code between your <head></head> tags in your theme's "template.html" file.
<SCRIPT LANGUAGE="Javascript"><!--
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
var EnableRightClick = 0;
if(isNS)
document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
 if(EnableRightClick==1){ return true; }
 else {return false; }
}
function mousehandler(e){
 if(EnableRightClick==1){ return true; }
 var myevent = (isNS) ? e : event;
 var eventbutton = (isNS) ? myevent.which : myevent.button;
 if((eventbutton==2)||(eventbutton==3)) return false;
}
function keyhandler(e) {
 var myevent = (isNS) ? e : window.event;
 if (myevent.keyCode==96)
   EnableRightClick = 1;
 return;
}
document.oncontextmenu = mischandler;
document.onkeypress = keyhandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
//-->
</script>

marcamillion

Now....here is another challenge. How do you disable right click for just annonymous guests.....but not for members ? Is that possible ? General feedback I am getting, friends use the site to "trade" pictures, so they save their friends pics and vice versa.

Rachelle

another question though..is do you really want to go through all that trouble.  The no right click really doesn't work all that well.. just view source find the image and link it right to the url and you have the picture.. and if the user isn't smart enough to do that.. they could still capture the screen... ie: alt print screen and they have a picture of your whole page to crop and get the picture from that.

It's almost like locking the doors on a convertable, while leaving the top down..they'll still be able to get in... :-\\


marcamillion

well...to us tech saavy people that might seem like a stupid thing to do, because there are many ways around it. But it will deter and keep away the casual trouble-maker who aint so tech saavy.

There really is nothing to do to keep someone from copying the picture if they want to, but this will reduce it and make it a little more tedious.

Rachelle

True that..and very good point, if they want to take the pictures.. make them work at it ;)


marcamillion

So is there anyway to limit it to members only or non-members rather ? As in....only allow non-members to not be able to steal the pics ? Anyway to do this ?


Joachim Müller

there is a way, but this will need a bit more complicated approach, since you can't have the no-right-click script in template.html then. Instead, you'll have to put it into theme.php, together with an if/then switch that checks wether the user has logged in. Modify the header function accordingly (and no, I won't create any ready-to-copy'n-paste code for this, as I don't see any point in disabling right-clicks anyway).

GauGau

marcamillion

would anyone be willing to do this for me ? I am a noob at php/mysql....if you tell me what code to put where I can do it. Please can someone help me out.