Monday, February 18, 2013

Disable Right Click on your Website

Hi, Friends. How are you? I am fine. Hope you have seen my previous post. If still you have not seen, please visit my blog. If you want to get update with my site please visit regularly.


Sometimes you need not to copy your content by the user or you want disable right click for your security purpose. So you need to disable right click on your page.




To do so, paste the below code in your webpage.



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





If you want to place the code in your blog, goto Layout--Add a Gadget--select HTML/JavaScript Gadget--then paste the code and save it.



Thanks.

No comments :

Post a Comment