Disable Right Click Menu in HTML

When browsing a webpage, you typically can click the right button on the mouse to reveal a context menu. The right click context menu usually has options such as Back, Forward, Reload, Stop, and View Page Source. When right clicking on an image, you have have the option to save the image or even set it as the desktop background. It’s rare but sometimes you want to disable the right click context menu. To disable the right click context menu you can set the oncontextmenu event to return false.

<body oncontextmenu="return false;">

If you only want to disable the right click context menu on a small part of your site, for example an image you don’t want your visitors to easily download or save you can add the oncontextmenu property to any div or img tag and disable the context menu only in that HTML tag.

Related posts:

  1. Hide Your HTML Source
  2. Joomla! Sections and Categories
  3. CDATA With XSLT
  4. Microsoft Power Tools for Windows XP
  5. Print HTML Using IE
  6. HTML FieldSet Tag

Leave a Reply