Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > FAQ Topic - How do I suppress a context menu (right-click menu)? (2012-02-22)

Thread Tools

FAQ Topic - How do I suppress a context menu (right-click menu)? (2012-02-22)

FAQ server
Posts: n/a
FAQ Topic - How do I suppress a context menu (right-click

A context menu, often triggered by right-click, can be requested by the
user in a few ways. For example, on windows, shift + F10 and on macs,
click-and-hold. Other input devices exist and mouse buttons can be
configured, making the term "right click" a misnomer, in context.

In browsers that allow it, a script can suppress the context menu by
returning false from an object's `oncontextmenu` event handler.

document.oncontextmenu = function() {
return false;

Some browsers lack context menus (e.g. iphone). Browsers that have
context menus do not always have a scriptable event for them. Some
browsers can be configured to disallow scripts from detecting context
menu events (IE, Opera); others may fire the event but be configured to
disallow scripts from suppressing the context menu (Firefox,Seamonkey).

Even when the context menu has been suppressed, it will still be
possible to view/save the source code and to save images.


The complete comp.lang.javascript FAQ is at


The sendings of these daily posts are proficiently hosted

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
add menu item to context (right-click) menu? lcplben Javascript 3 10-30-2009 11:56 PM
FAQ Topic - What questions are on-topic for CLJ? (2008-10-16) FAQ server Javascript 1 10-16-2008 12:03 PM
Can I holdup and activate the context-menu as a sub-menu? Michel Javascript 2 08-02-2004 09:54 PM
Context.Items vs Context.Handler (passing values between pages) VS_NET_DEV ASP .Net 2 05-25-2004 01:16 PM