Disable context menu by returning false from oncontextmenu - Javascript DOM Event

Javascript examples for DOM Event:oncontextmenu

Description

Disable context menu by returning false from oncontextmenu

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width"> 
   </head> 
   <body>
       No developer toolbar //w w w  .ja va 2 s .  c om
      <script>
window.oncontextmenu = function () {
   return false;
}
document.onkeydown = function (e) {
    if (window.event.keyCode == 123 ||  e.button==2)
    return false;
}

      </script>  
   </body>
</html>

Related Tutorials