Disabling "Right Click" On Pages Disabling "Right Click" On Pages
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Disabling "Right Click" On Pages

Started by fmk, January 02, 2011, 11:44:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fmk

Disabling "Right Click" Using Javascript in Theme's Template.html could be a good idea to prohibit users from viewing the page sources that actually includes the albums/myalbums path and image paths.

Although I am waiting for a good pluginhttp://forum.coppermine-gallery.net/index.php/topic,69397.0.html, but I tried using this in Theme's Template.html



<script language=JavaScript>
<!--

//Disable right mouse click Script

var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>


my site http://igallery.khanz.net

Can Devs make a small plugin out of it?
FMK

Love doesn't stop by my door, I am always infatuated with new things.

ΑndrĂ©

Disabling the right click doesn't increase the security. You always can access the page source with the browser menu and/or a keyboard shortcut. Disabling JavaScript disables your script, too.

Quote from: fmk on January 02, 2011, 11:44:31 PM
Can Devs make a small plugin out of it?
You can do that yourself. Just have a look at some already existing plugins that just add some JavaScript (e.g. the Keyboard Navigation plugin).

fmk

You were right Andre, that script blocked my user login for some reason. Login was looping back to Index.php showing Welcome Guest on the top and user remained unlogged-in even after entering the username/password. That was happening on system that didn't have cookies for my site. But I was able to login after a few hours on my PC, so I am now quit sure what was the exact issue but I have removed the script. As far plugin creating is concerned, I don't know coding.
FMK

Love doesn't stop by my door, I am always infatuated with new things.

flappjaxxx

I use this script for mine with no issues:
in template.html between <body> &  {CUSTOM_HEADER}