Saturday, December 7, 2013

How to disable right click option on your blog posts

Today I will teach you how to disable right click option on your blog or blog posts. Many a times we write posts with our long research and creativity and we find same content on other sites which is actually copied from our post. By learning this tutorial you can disable the right click option from your blog which will avoid content coping from your blog.

Before proceeding I would like to tell you that use this tutorial only if your site contains contents that you don't want to copy by anybody not even by your readers. For example if you are hosting a blog about codes or programs sharing then you readers will be no more able to copy that codes which will become useless for them.

HOW TO DISABLE RIGHT CLICK ON YOUR BLOG

STEP 1. Go to blogger dashboard >> Layout >> Add a gadget

STEP 2. Choose HTML/Java Script widget.
Now copy the below mentioned code and paste it to the above opened HTML/Java gadget.

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

STEP 3. After pasting this code save the gadget.
STEP 4. Save the layout.
Now you are all done. Mouse right click option will be no more available on your blog.

No comments:

Post a Comment

© All about engineering, AllRightsReserved.