Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




The JavaScript FAQ
Prev Home Next

Disabling the Right-Click Menu For an Image

Question: Can I disable the right-click context menu for a particular image, while still enabling the menu for all other parts of my page?

Answer: Yes. In most modern browsers you can disable the right-click menu for a particular image. To do so, you can use the event handler oncontextmenu="return false;" within the IMG tag that defines your image:

<IMG border=0 src="..." oncontextmenu="return false;">
For example, the context menu has been disabled for this image:

Note: In older browsers (e.g. Internet Explorer 4.x or earlier) this trick won't work. Also, the context menu will show up if the user has disabled JavaScript. Copyright © 1999-2006, Alexei Kourbatov

The JavaScript FAQ
Prev Home Next

  Mirrored with kind permission of Alexei Kourbatov Design by Interspire