Wednesday, September 23, 2009

Turn Off Right Click

right click
Sometimes, you may be want the html source of your blog not easy to see or may be we want to hide the properties. One of many ways to to it is by turn off or disable right click.
Below are the script that you can use to turn off the right click.
Just copy the code and paste it between <head> and </head> tag.
<script language="JavaScript">
var message="Sorry..! Right Click is NOT ALLOWED";
///////////////////////////////////
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>
Just try the code and drop your comment below.
Thanks...!

8 comments:

Please submit your comments below.
If you find an error on word verification, just click at the "word verification" to show the word verification box.
Thanks