By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,568 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,568 IT Pros & Developers. It's quick & easy.

Firefox: right mouse button

P: n/a

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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a

"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 discussion thread is closed

Replies have been disabled for this discussion.