Open
Bug 911746
Opened 11 years ago
Updated 2 years ago
special-case javascript: URLs that return undefined if link target is _blank
Categories
(Core :: DOM: Core & HTML, defect, P5)
Core
DOM: Core & HTML
Tracking
()
NEW
People
(Reporter: hsteen, Unassigned)
References
Details
(Keywords: dev-doc-needed)
Attachments
(1 file)
Spun off from bug 790893: some pages break due to constructs like <a href="javascript:doFoo()" target="_blank"> or javascript: links in a page that has BASE target=_blank. It is nevertheless considered proper and important to support target=_blank for javascript: links that generate HTML. The best solution may be to only respect target=_blank for javascript: links if they actually generate some output. (By memory, Opera changed to doing this for shift-clicking javascript: links a long time ago, and probably handled target=_blank as a side effect of this)
Updated•11 years ago
|
OS: Linux → All
Hardware: x86 → All
Comment 1•11 years ago
|
||
Olli, what do you think? There's some compat risk here, but hopefully not too much...
Attachment #802030 -
Flags: review?(bugs)
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment 2•11 years ago
|
||
The particular compat worry is: <a onclick="window.open('javascript:')">Click me</a> and expecting that window to stick around. We don't really have a way to tell that case apart from the <a href="javascript:" target="_blank">Click me</a> case...
Updated•11 years ago
|
Whiteboard: [need review]
Comment 3•11 years ago
|
||
So what do other browser do in that case? <a onclick="window.open('javascript:')">Click me</a> looks pretty important to not break.
Comment 4•11 years ago
|
||
> So what do other browser do in that case?
Open a window.
Comment 5•11 years ago
|
||
What I could do is restrict the auto-closing behavior to cases when the script is nonempty. That would keep 'javascript:' working as now. Feeld hacky.
Comment 6•11 years ago
|
||
Oh, I think I misunderstood. I thought any onclick="window.open('javascript: ....')". When window.open is called, someone clearly wants to open a new window. And even if value isn't returned, javascript: url may generate content by accessing document.body.innerHTML for example.
Comment 7•11 years ago
|
||
> I thought any onclick="window.open('javascript: ....')".
That's basically what the current patch does, yes....
Comment 8•11 years ago
|
||
Comment on attachment 802030 [details] [diff] [review] If a javascript: load had no return value and was being opened in a new window, close the new window, since it's not actually needed for anything. So I'm not really ok with this. window.open is window.open
Attachment #802030 -
Flags: review?(bugs) → review-
Comment 9•11 years ago
|
||
OK, but target=_blank is semantically equivalent to window.open. Sounds like we should wontfix this bug, then....
Updated•11 years ago
|
Assignee: bzbarsky → nobody
Whiteboard: [need review]
Reporter | ||
Comment 10•11 years ago
|
||
I agree that window.open('javascript:..') needs to work. It would be nice if the <a href="javascript:..." target="_blank"> case could be detected at an earlier stage so that we could prevent opening the window rather than auto-closing it (and make it target=_blank only, not window.open()). If that's not possible I guess we have to wontfix :-/
Updated•11 years ago
|
Keywords: dev-doc-needed
Reporter | ||
Comment 12•10 years ago
|
||
last site found to assume this will be ignored: Google Maps. See dup. :-/ Simple proof: for(var i=0; i<document.links.length; i++)if(document.links[i].target && /javascript:/.test(document.links[i].href))document.links[i].target='' makes the problem go away.
Comment 13•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Comment 15•6 years ago
|
||
No assignee, updating the status.
Comment 16•6 years ago
|
||
No assignee, updating the status.
Comment 17•6 years ago
|
||
No assignee, updating the status.
Comment 18•6 years ago
|
||
No assignee, updating the status.
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•