Disable Right Click

[Total: 0    Average: 0/5]

This example shows how to really disable the right click.

Head Code:

<script type=text/javascript>
var msg = "Right Click Is Disabled";
if(document.layers) window.captureEvents(Event.MOUSEDOWN);

function no_click(e){
if (navigator.appName == 'Netscape' && ( e.which == 2 || e.which == 3))
 {
  alert(msg);return false;
 }
 if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))
 {
   alert(msg);return false;
 }
}
window.onmousedown=no_click;
document.onmousedown=no_click;
</script>

Body Code:

This example shows how to really disable the right click.
As long as the user has javascript enabled, (s)he really can not use the right click on your window.
This only works for IE and NS browsers.
NOTE: There is a way to actually get the menu to appear - clicking the right button while pressing the space bar can get the menu to appear.  Not always - it must be a weird timing issue.  If you find a fix for this [so no one can get the menu to appear] please let us know!
Thanks.

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *