forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 permissions => Topic started by: fmk on January 02, 2011, 11:44:31 pm
-
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 (http://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?
-
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.
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).
-
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.
-
I use this script for mine with no issues:
in template.html between <body> & {CUSTOM_HEADER}