[close]
Don't Forget to Support Us, Click my Ads :)

Friday, 18 November 2011

Disabling Right Click in Blogger Blog




Have 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.

Provided cross browser DHTML script from dynamicdrive will help you achieving the same result on your own blog, preventing default right menu from popping up when right mouse is clicked. There are actually two options for this script are provided: Alert Option and Non-alert Option. If the Alert Script is enabled, if someone tries to execute Right click on the blog, then a Message, which can be customized per your desire, appears. If the Non-alert script is activated, then no message is displayed.







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

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


<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>


Step 3 : Save the html/javascript and view you blog.
When you will try to do right click, a message will tell you that “Function disabled” , and if you want to change this words” Function Disabled” Then simply find it in code and replace it.
  

 

Best viewed using Mozilla Firefox 13, Google Chrome or Internet Explorer 7.0 and above with 1024 X 768 screen resolution.

Related Posts with Thumbnails