Open Bug 1237226 Opened 8 years ago Updated 2 years ago

target attribute is ignored with an anchor with download attribute even if the download is overridden by explicit Content-Disposition from the server

Categories

(Core :: DOM: Navigation, defect)

43 Branch
x86_64
Windows 7
defect

Tracking

()

UNCONFIRMED

People

(Reporter: megaman, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36

Steps to reproduce:

create a link:
<a target="_blank" download="test.txt" href="/cgi-bin/test">

/cgi-bin/test contains a web page with HTTP header "Content-Disposition: inline".


Actual results:

the content of /cgi-bin/test will replace the source page.


Expected results:

the content of /cgi-bin/test should be opened in a new window
OS: Unspecified → Windows 7
Hardware: Unspecified → x86_64
Component: Untriaged → Document Navigation
Product: Firefox → Core
We explicitly ignore the target attribute when the download attribute is supplied.  Tom, why do we do that, exactly?  You have blame for that code, and there is no clear explanation of why it's done.

Given that, the problem here is that the explicit Content-Disposition header then overrides the download attribute, so the download doesn't actually happen.  That's something else we've considered changing.
Flags: needinfo?(evilpies)
Summary: target attribute notwork with an anchor with download attribute → target attribute is ignored with an anchor with download attribute even if the download is overridden by explicit Content-Disposition from the server
(In reply to Boris Zbarsky [:bz] (Vacation until Jan 4) from comment #1)
> We explicitly ignore the target attribute when the download attribute is
> supplied.  Tom, why do we do that, exactly?  You have blame for that code,
> and there is no clear explanation of why it's done.
> 
Not sure about that, where does that happen? I have no idea at the moment.
> Given that, the problem here is that the explicit Content-Disposition header
> then overrides the download attribute, so the download doesn't actually
> happen.  That's something else we've considered changing.
Yeah. Right now we only allow same-origin downloads anyway, so overriding what the server asks for might just be fine. I think this was discussed before.
Flags: needinfo?(evilpies)
Can confirm this also happens on FF 45 on MacOS X 10.10.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.