Search This Blog

Wednesday, October 27, 2010

How to Disable Right click in Blogger /Blogspot ?

Did you noticed? that some web sites do not allow their visitors using right mouse click while pointer is on the blog area.  This option is useful for the site and blog owners, who want to minimize the possibilities of the content direct  copying  to other posts.


To Setup this tool in your blog Copy the Following code and paste it to your blog by adding a new page element. 


1-  Go to Dashboard > Layout > Add Gadget > HTML / JavaScript
2-  Copy the following code and paste it there .


<script language="JavaScript">
<!--

//Disable right mouse click Script

var message="
May be copyright ";

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>


3-  Save the html/javascript and view you blog. 


How it works?
If you right click on the webpage, a message will pop up on screen saying "May be copyright". If you want to change the message to you own one like "Function disabled" or something like that, replace the "May be copyright" text with your own message in the Javascript code.


Submit your valuable comments, happy trying!



1 comment: