links which are coded with the onclick attribute cannot be middle-clicked




Event Handling
13 years ago
13 years ago


(Reporter: Navid, Unassigned)


Windows XP

Firefox Tracking Flags

(Not tracked)




(1 attachment)



13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050406 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050406 Firefox/1.0.3

When a link is coded by using the onclick attribute to change
document.location.href, it cannot be middle-clicked.  

For a normal user, it will seem odd that a link produces no effect (regularly a
new tab) when they middle-click it.  The link will produce an effect when it is

Reproducible: Always

Steps to Reproduce:
1. Go to
2. Middle-click on one of the main news items.

Actual Results:  
The page scroll cursor appears

Expected Results:  
The link should have opened in a new tab.

I'll attach a simple testcase.

Comment 1

13 years ago
Created attachment 180628 [details]
html testcase showing the bug

*** This bug has been marked as a duplicate of 156137 ***
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE

Comment 3

13 years ago
This is not a duplicate of bug 156137. Reporter wants the link to open in a
*new* tab, so this is more like bug 55696, except 
1) it doesn't say anything about links with "onclick" handlers
2) it doesn't apply to non-links, which is what the testcase shows.

Reporter, do you really want to work it for <td onclick=...> or is it for links
only (as summary states)? In the former case, please reopen this bug, updating
summary accordingly.

Comment 4

13 years ago
I do want a middle-click to work on <td onclick="...> when the onclick=""
specificies a change in the url of the page.

At, for a general user two things are obvious over the table cell
  1. the pointer appears over the table cell
  2. the table cell is clickable and the page changes. 
Thus for them the table cell seems like a normal link.  They don't know the
difference between the table cell with onclick="" and a normal link.  

Thus if they choose to middle-click it, which ordinarily opens a new tab, and it
doesn't work, it seems to be a bug in firefox.

I understand why, however, why it might be a bad idea as per bug 156137 to
implement the change.  Maybe the onclick handler has to be a bit smarter, only
accepting the middle click, when the onclick specifies a change in the url.

Comment 5

13 years ago
> Thus for them the table cell seems like a normal link.

That's a evangelism bug I would say (that is should be convinced not to
disguise <td>s as links). The request for handling middle-clicks in such a way
for all elements is quite hard to implement, and IMHO, should be wontfixed.
You need to log in before you can comment on or make changes to this bug.