JavaScript Copyright Protect (Right Click)

 

 

This script will prevent users from right clicking on your site.

Although this script will protect the 'right click' it does not prevent the user from accessing the source from the browsers main menu.

 

 

Example

Try and right click this page!

 

Script Source

 

<Link to the external script - add this under the head section>

<script type="text/javascript" src="private.js"></script>

 

<The JavaScript - private.js >

// by www.wizzardweb.co.uk

var message="Sorry! All information on this site is copyright www.wizzardweb.co.uk";

///////////////////////////////////
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")

 

Please let me know if this script was helpful to you.

[rating]