Sunday 1 January 2012

Disable right click on website using javascript


 
Write this code on javacript to disabling right click:-
 

<script language="javascript">
document.onmousedown=disableclick;
status="Right Click Disabled";
Function disableclick(e)
{
  if(event.button==2)
   {
     alert(status);
     return false; 
   }
}
</script>
 
I have also another method simply one line code use this:-
<body oncontextmenu="return false">
...
</body>

No comments:

Post a Comment