0
Posted on 9:46 PM by prajeesh and filed under
Some websites does not allow right click context menu option for security reasons, you can also achieve this by adding following code to your body tag of the page.
  1. <body oncontextmenu="return false;" >   

Alternatively, you can show an alert saying "Right click disabled" if you call a function from body tag's oncontextmenu event, for eg:-
  1. <script language ="javascript">  
  2.   
  3.     function contextalert() {  
  4.   
  5.         alert("Right click disabled");  
  6.   
  7.         return false;  
  8.   
  9.     }  
  10.   
  11. </script>   
  12.   
  13. <body oncontextmenu="return contextalert();" >  

Disclaimer: I have tested this functions in IE7 and Mozilla 3.0 only , it will not work in Opera.
Enjoy coding

Shout it kick it on DotNetKicks.com
0
Responses to ... Disabling right click menu in a web page