Skip navigation

JSI Tip 9487. How do I prevent the right-click context menu from appearing on a Web page that I authored, using Internet Explorer 5.0 or later?

To prevent Internet Explorer 5.0 or later from displaying a content menu when a user right-clicks in a Web page, add the following to the <BODY> tag:

onContextMenu="return false"

Example:

If your <BODY> tag is:
<BODY BGCOLOR="#ffffff" LINK="#8c2118" ALINK="#ff0000" VLINK="#666666" TEXT="#8c2118" marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">

alter it to be:

<BODY onContextMenu="return false" BGCOLOR="#ffffff" LINK="#8c2118" ALINK="#ff0000" VLINK="#666666" TEXT="#8c2118" marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
NOTE: You should NOT be presented with a context menu when you right click the body of this page.


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish