How to Disable 'Right Click'

This is a script that will prevent the default right menu from popping up when the right mouse is clicked on the web page. Instead, message like 'Function Enabled' or 'No Right-Click!' will be shown (this can be edit later using the script). It is useful if you don't want visitors to cut and paste your text or image.
To install this, go to Template -> Page Elements. Next, add a Page Element -> then Add a HTML Widget, then cut and paste this code below. Easy as ABC!! View the script below.

<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="No Right-Click!";

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


0 comments: