Right-click
Posted: Thu Feb 19, 2004 3:35 am
Can we make our page can't be right-clicked? I mean if we right-click at any pages, then nothing heppen. Anybody know?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<script language=JavaScript>
<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
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>Code: Select all
<script language=JavaScript>
<!--
//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script>Whatever you do, do not use that, it disables a lot more than right clicking and becomes somewhat of an annoiyance.microthick wrote:This also seems to work, at least for IE.
<body oncontextmenu="return false">
Why? Right click provides no functions that a user would need to view a page or navigate... a user visiting a site dont need right click peroid unless they are up to no good, so as far as right click disabling being lame, thats just silly.monkeyj wrote:Hey personally.. I find anti-right clicking sites are annoying..
Don't do it.. o.o
I mean
If the person wants your image..
They can d/l it from the source... directly.. or w/e..
but.. Disabling right click is lame.. o.o
Just put SAMPLE over it..
but it is annoying o.o