Jump to Real's How-to Main page

Disable Browser Context Menu

<SCRIPT type="text/javascript">

  function disableContextMenu(element) {
    element.oncontextmenu = function() {
       return false;
    }
}

function onLoad() {
    disableContextMenu(document.getElementById("myimage"));
}

</SCRIPT>
...
<BODY onload="onLoad()">
On this image, you have context menu (right-click)

On this image you have no context menu (right-click)

NOTE: Works on IE but... on Firefox a setting can disable the ability for a script to block the context menu


If you find this article useful, consider making a small donation
to show your supportfor this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2007
[ home ]