473,503 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firefox: right mouse button


I'm trying to use the right mouse button to open a popup on a specific
element. The popup is triggered by a mouseup event. However, on
mousedown the standard context menu opens. To get around this, I listen
to that event, too, and stop it (preventDefault, stopPropagation). That
works on Konqueror (and presumably other KHTML-based browsers), but not
on Firefox. The latter still opens its context menu.

My search has turned up literally hundreds of blocker scripts for the
right mouse button. The few I've tested don't appear to work as
advertised with Firefox.

Now, my intention isn't to block my users from doing anything, rather
I'd like to offer them a form of interaction they're used to. In this
case the ability to access the settings of an object by right-clicking
it. Is it possible to make this work across browsers?

Michael

--
Michael Schuerig Thinking is trying to make up
mailto:mi*****@schuerig.de for a gap in one's education.
http://www.schuerig.de/michael/ --Gilbert Ryle

Sep 17 '05 #1
3 10649
Michael Schuerig wrote:
I'm trying to use the right mouse button to open a popup on a specific
element. The popup is triggered by a mouseup event. However, on
mousedown the standard context menu opens. To get around this, I
listen to that event, too, and stop it (preventDefault,
stopPropagation). That works on Konqueror (and presumably other
KHTML-based browsers), but not on Firefox. The latter still opens its
context menu.


Use the oncontextmenu handler, which is supported by both FF and IE:

window.oncontextmenu = function () { return false; }
JW

Sep 18 '05 #2
Janwillem Borleffs wrote:
Michael Schuerig wrote:
I'm trying to use the right mouse button to open a popup on a
specific element. The popup is triggered by a mouseup event. However,
on mousedown the standard context menu opens. To get around this, I
listen to that event, too, and stop it (preventDefault,
stopPropagation). That works on Konqueror (and presumably other
KHTML-based browsers), but not on Firefox. The latter still opens its
context menu.


Use the oncontextmenu handler, which is supported by both FF and IE:

window.oncontextmenu = function () { return false; }


Thanks, that does it.

Michael

--
Michael Schuerig Those people who smile a lot
mailto:mi*****@schuerig.de Watch the eyes
http://www.schuerig.de/michael/ --Ani DiFranco, Outta Me, Onto You

Sep 18 '05 #3

"Michael Schuerig" <mi*****@schuerig.de> wrote in message
news:dg**********@newsreader3.netcologne.de...

I'm trying to use the right mouse button to open a popup on a specific
element. The popup is triggered by a mouseup event. However, on
mousedown the standard context menu opens. To get around this, I listen
to that event, too, and stop it (preventDefault, stopPropagation). That
works on Konqueror (and presumably other KHTML-based browsers), but not
on Firefox. The latter still opens its context menu.

My search has turned up literally hundreds of blocker scripts for the
right mouse button. The few I've tested don't appear to work as
advertised with Firefox.

Now, my intention isn't to block my users from doing anything, rather
I'd like to offer them a form of interaction they're used to. In this
case the ability to access the settings of an object by right-clicking
it. Is it possible to make this work across browsers?


Why are you trying to immitate desktop software behaviour in a web page?

Big mistake.

Remember web pages are basically just documents - trying to force them to
behave like 'real' software applications is a recipie for disaster.
Beleive me, I learned the hard way.

Either write software and do your right-clicking etc. there, OR write web
pages and accept that they're not designed to support those things.

Owen
Sep 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5147
by: David Hayes | last post by:
I've made tooltips work in Firefox*, but tooltip doesn't appear at the specified location until the SECOND time that the user passes the mouse over the location with the mouseover event. What I...
13
2275
by: James Bond | last post by:
Hello. My 80+ year old father has recently decided to get his first computer. Due to his age (and I suspect lack of playing pong as a child like I did) he lacks the manual dexterity to use a mouse...
1
6258
by: OtisUsenet | last post by:
Hello, I have some onClick events in <a href...> elements, so they get called when a user clicks on a link. This works well, and looks like this: <a onclick="onLinkClick(123);"...
3
6812
by: atn2002 | last post by:
I'm trying to create a control which when the mouse button gets pressed on one div an absolute positioned div pops up in place of the cursor. From there the cursor should interact with the dialog...
1
9100
by: Charlie | last post by:
I want to detect and act on right button clicks in Firefox. The problem was I kept getting the context menu pop up on right button clicks, even when I called event.preventDefault(). I had assumed...
6
9698
by: marss | last post by:
Hi, How can I define in Firefox whether the left mouse button is pressed when I move mouse over a html element? The documentation says that "e.button == 0 for standard 'click', usually left...
1
1306
by: Louis | last post by:
Thanks in advance for any comment and suggestion... On one of my web pages, I use javascript to pop up a context menu box when the right-mouse button is clicked on a link. It works fine in...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.