Friday, April 6, 2012

Disable Right Click At Your Website Using Javascript

Disable Right Click At Your Website Using Javascript 
 
Disabling right click at your website may help you in protecting your content like text from copying easily. Now a days many peoples are copying and pasting the content from other websites to their own website.

But using below javascript code you can disable the functionality of right mouse click at your website so that the users will not be able to copy your content.

However this is not a 100% guaranteed way to protect the content but it may help you a lot in protecting your content.

Just copy and paste the below code in between your head area (i.e.: <head>Below Code here</head>).
Code:

<script type="text/javascript">
<!--
var message="Put a custom message here.....";
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(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=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script>

No comments:

Post a Comment