Closed
Bug 349279
Opened 19 years ago
Closed 15 years ago
anchor href is followed even if onclick returns false when command-clicking
Categories
(Firefox :: Tabbed Browser, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: free.leekai, Unassigned)
Details
(Whiteboard: [CLOSEME 2010-11-15])
Attachments
(1 file)
|
3.38 KB,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1b2) Gecko/20060818 BonEcho/2.0b2
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1b2) Gecko/20060818 BonEcho/2.0b2
Traditionally, if an anchor's onclick returns false, its href is suppressed. However, Firefox 1.5.0.6, Bon Echo Beta 2, and Minefield do not suppress the href when command-clicking (or control-clicking).
(They do suppress it when single-clicking or clicking with modifier keys that aren't bound to tab generation, and SeaMonkey 1.5a always suppresses it correctly.)
A common instance of this problem is when onclick involves window.open and an href is also supplied, which is a fairly common method of generating sized pop-up windows while still wishing to be accessible to user agents without javascript.
In this case command-clicking in my nonsuppressant browser displays the onclick pop-up as if I had single-clicked the link (according to my tab v window preferences), but then also activates the href as if I had command-clicked the link (always in a new tab). This is especially confusing if the link in the href is intended only for users without javascript, but the fact that two new window objects are created is bad enough.
Gmail in its standard view, for example, has both href and window.open for links embedded inside emails. When I have Firefox set to open new pages in new windows, command-clicking causes one page (from onclick) to open in a new window and the other (from href) to open in a new tab (because of command-click). When I have Firefox set to open new pages in new tabs, command-clicking causes two identical new tabs to open, which just highlights the ridiculousness.
It is also interesting to note that I haven't seen any browser besides Firefox display the javascript-generated window in a new tab; I can't find a preferences setting on any of the suppressant browsers to make a new page open in a new tab on single-click. What command/control-click should do when that preference is set is a separate interesting topic.
Reproducible: Always
Steps to Reproduce:
Command/control-click on an anchor that has both href="url1" and onclick="window.open(url2); return false;"
Actual Results:
Both urls are followed
Expected Results:
Only the onclick url should be followed if javascript is enabled; otherwise only the href url should be followed
| Reporter | ||
Comment 1•19 years ago
|
||
(In reply to comment #0)
> In this case command-clicking in my nonsuppressant browser displays the onclick
> pop-up as if I had single-clicked the link (according to my tab v window
> preferences),
> Steps to Reproduce:
> Command/control-click on an anchor that has both href="url1" and
> onclick="window.open(url2); return false;"
Sorry, there are two inaccuracies here. First it should be "window.open(name, url2, misc)", not as above, and in the mode where new pages open in new tabs the javascript-generated window opens in a new tab if and only if misc is nonempty.
| Reporter | ||
Comment 2•19 years ago
|
||
(In reply to comment #1)
> "window.open(name, url2, misc)"
Bah, open(url2, name, misc).
Something i didn't realize before is that while Bon Echo has the two preferences (open new page in new window or open new page in new tab), Firefox 1.5 has three (with the addition of open new page in same window/tab). With that third setting, whether or not command-clicking opens two new pages depends on whether or not target="_blank". Surprisingly (to me, at least), if there is no target attribute one page opens in a new tab and one page opens in the original tab, whereas if target="_blank" both pages open in the original tab (I think that's what's happening), so only one gets shown.
| Reporter | ||
Comment 3•19 years ago
|
||
(In reply to comment #2)
> With
> that third setting, whether or not command-clicking opens two new pages depends
> on whether or not target="_blank".
Again, incorrect. Just target makes no difference; it depends on something else I haven't been able to pinpoint in Gmail's javascript code (and I don't plan to keep looking for it so if someone knows please tell me).
Comment 4•15 years ago
|
||
This bug was reported using Firefox 3.0 or older, which is no longer supported. The bug has also not been changed in over 500 days and is still in UNCO.
Reporter, please retest this bug in Firefox 3.6.10 or later using a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles. If you still see this problem, please update the bug. If you no longer see the bug, please set the resolution to RESOLVED, WORKSFORME.
This is a mass search of unconfirmed bugs that have no activity on them, so if you feel a bug was marked in error, just remove the CLOSEME comment in the whiteboard within the next month.
Whiteboard: [CLOSEME 2010-11-15]
Comment 5•15 years ago
|
||
No reply, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•