Disable right mouse click
Page 1 of 1•
Disable right mouse click
This code disables right click on the page that contains the code. This works in FireFox 1+ and Internet Explorer 5+.
To add this to you site, just paste the following code to the <BODY> section of your web page:
Almost forgot, you can change the var message="Function Disabled!"; text to make the popup warning message say something else. For example, you may want it to say Right click is disabled on this website. The code for that would be: var message="Right click is disabled on this website.";
Hope someone finds this useful.
To add this to you site, just paste the following code to the <BODY> section of your web page:
- Code:
<script language=JavaScript>
<!--
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>
Almost forgot, you can change the var message="Function Disabled!"; text to make the popup warning message say something else. For example, you may want it to say Right click is disabled on this website. The code for that would be: var message="Right click is disabled on this website.";
Hope someone finds this useful.

Affiliate






