Closed
Bug 72084
Opened 24 years ago
Closed 24 years ago
There is no way to disable the context menu upon right-click (oncontextmenu?)
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: bcortez, Assigned: hyatt)
References
()
Details
Currently, is there any way to completely disable the right-click context menu in the Mozilla browser? For Mozilla to be a valuable business application platform, application developers need a JavaScript event handler exposed to disable the display of the context menu. This would prevent users from inadvertantly opening the current application in a new browser window....which could have serious side-effects in a stateful application model. NOTE: MSIE currently exposes the 'oncontextmenu' event which can be used to disable the display of the context menu. A simple call such as: document.oncontextmenu = function(){return false}; accomplishes this task.
Comment 1•24 years ago
|
||
There are loads of javascrips doing this. Here's one working with Mozilla http://www.dynamicdrive.com/dynamicindex9/noright.htm
Comment 2•24 years ago
|
||
On a further comment, document.oncontextmenu is a proprietary feature of internet explorer
This code snippet does not fully work in Mozilla/Netscape 6. IT only half works...let me explain. When you right-click on the document, the context menu appears, then a JavaScript alert box appears. The side-effect of the alert box appearing is that it seems to cancel the context menu (and it disappears). However, if you mouse over the context menu as soon as it appears (prior to the alert box), once the alert box appears, the context menu stays displayed and is fully active. Therefore, there is no way to truly disable the display of the context menu in Mozilla/Netscape 6 as I originally stated.
Comment 4•24 years ago
|
||
ccing mpt to see what he says
What bcortez describes about the context menu displaying briefly is another bug. I remember reading it, but I can't remember what it was (and I'm at work). The keeping open of the context menu was related to bug 45108 and fixed the other day. It just hasn't made it to the servers yet due to the internal problems.
Comment 6•24 years ago
|
||
Cc ianh and bob clary. See also agreeing with this bug: bug 28604 [DOM] Context menu should wait for onclick / onmousedown handler bug 60889 handler doesn't get called if context-menu is active onClick disagreeing with this bug: bug 14716 [RFE] don't popup new windows while mouse button is down bug 40535 [RFE] disallow/queue alert (and window.open?) on right-click
Summary: There is no way to disable the context menu upon right-click → There is no way to disable the context menu upon right-click (oncontextmenu?)
Bug 36665 may be related, or at least in a related area dealing with the context menu.
Comment 9•24 years ago
|
||
there is now an oncontextmenu event. js handlers can call event.preventDefault() and the context menu will never fire. --> hyatt so he gets credit on his p4.
Assignee: joki → hyatt
Comment 10•24 years ago
|
||
fixed.
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 11•24 years ago
|
||
<quote src="bug 28604" author="me"> IMO, it is none of the business of a webpage to mess with context menus in any way. Sometimes (e.g. after a window.open or when I minimize the normal chorme), the context menu is my only way to interact with the app. E.g. to access "View Source" or to specify how to open a link or anything. A webpage must not be allowed to interfere with my ability to do so. I have seen pages that tried to prevent me from looking at the source. This must not happen. In this case, a don't care about any W3C spec. This is basic usability. At the very least, I must have the option (with UI) to disallow such malicious behaviour of webpages. Everything else is IMO a serious bug. </quote>
Reporter | ||
Comment 12•24 years ago
|
||
Ben, I understand your concern and the reasoning behind your statements, however, for Mozilla to be seriously considered (and truly compete) as an enterprise platform for real web-based applications this is a necessity. Not for the sake of preventing the "view source" action, but for other more concrete reasons like mulithreading issues surrounding JAVA applets as one example. For a more through discussion, I suggest we take this offline. I wouldn't like to burden the recipients of this list with undue/off-topic emails.
Comment 13•24 years ago
|
||
bcortez, the discussion, if a bug should be fixed or not is ontopic to a bug. Nevertheles, I agree that newgroups are more approriate. Posted to .dom <news://news.mozilla.org/3ACDE0A2.6090209@beonex.com>.
Comment 15•24 years ago
|
||
Filed bug 86193 for option to revert the behaviour implemented in this bug.
Comment 17•23 years ago
|
||
*** Bug 73981 has been marked as a duplicate of this bug. ***
Comment 18•23 years ago
|
||
*** Bug 97600 has been marked as a duplicate of this bug. ***
Comment 19•23 years ago
|
||
*** Bug 98191 has been marked as a duplicate of this bug. ***
Comment 20•23 years ago
|
||
I think it is a good think oncontextmenu is now available in Mozilla, but I also understand people who hate sites blocking the general context menu without any reason but blocking access to viewsource etc. Maybe it would be a good idea to make something like an "Allow webpages to replace or block context menu" option in Preferences -> Advanced -> Scripts & Windows ?
Comment 21•23 years ago
|
||
Is there currently a prefs.js cheat available to disable websites from blocking the context menu? bwaaa
Comment 22•23 years ago
|
||
Simon: Not AFAIK. You're probably thinking of bug 86193.
Comment 23•22 years ago
|
||
*** Bug 160611 has been marked as a duplicate of this bug. ***
Comment 24•22 years ago
|
||
*** Bug 169290 has been marked as a duplicate of this bug. ***
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•