On Jan 17, 7:56 am, Nikola Ivanov <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm working an a very simple behavior: capturing clicks on anchors.
> Binding the click event and doing the rest of the logic is easy.
> Problem is the middle click (opens the link in a new tab) and both
> available options in the context menu: open in new tab/open in new
> window.

Control + click or command + click also opens links in a new tab for
some settings in some browsers.  I can also set Firefox to always open
new windows in a tab, trying to stop that is futile.


> While it's hard to imagine that the browser fires an event for the
> clicked option in the context menu, I'm looking now for capturing the
> middle click.
>
> And I've been looking for it for some time now. The close I get to my
> desired behavior is to bind the mousedown event.
>
> Do you know of a way to catch the middle-click? What do you think of
> mousedown?

Most don't bother trying to mess with things in the UI that should be
left to the user, such as what happens when a right or center moust
button is clicked, or where new windows open (if they are allowed at
all).  The results can also be different in different browsers.

But in answer to your question about determining which button was
used:

<URL: 
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MouseEvent-button
>

However, I'm not sure it's reliable or consistent across browsers.


--
Rob

Reply via email to