W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2011

[whatwg] "Content-Disposition" property for <a> tags

From: Glenn Maynard <glenn@zewt.org>
Date: Sat, 30 Apr 2011 14:05:05 -0400
Message-ID: <BANLkTi=LZf6OHt=WFfCTTdBH7NgaCUQ05g@mail.gmail.com>
On Mon, Apr 11, 2011 at 1:28 PM, Glenn Maynard <glenn at zewt.org> wrote:
> On Mon, Apr 11, 2011 at 12:48 PM, Eric Uhrhane <ericu at google.com> wrote:
>> Folks did propose making FileSaver do this at TPAC, but we haven't
>> gotten around to hashing out the details yet. ?The idea was that
>> FileSaver would take a URL instead of a Blob, and thus could also be
>> used for downloading arbitrary links.
> I missed that API; I like that approach.? <a href=url
> onclick="if("FileSaver" in window) { new FileSaver(this.href); return false;
> }">

Thinking about this some more, FileSaver can't handle
"Content-Disposition: filename" adequately.  For example, compare
FileSaver to the approach originally posted (with a slight

<a href="http://example.com/datastore/76cf656d2240be006aef7466a45628d1e531eb5c"
onclick="new FileSaver(this.href, 'downloaded_image.psd'); return
false;">Download PSD</a>

<a href="http://example.com/datastore/76cf656d2240be006aef7466a45628d1e531eb5c"
disposition=attachment filename=downloaded_image.psd>Download PSD</a>

The FileSaver method breaks if the user opens the context menu and
selects "save link as".  It also breaks if he selects the region of
text and uses a download manager's "download all selected links"
feature.  Tools like wget couldn't support this.  Drag-and-drop could
also take hints from @filename, so dragging the link into Photoshop
could give it the correct filename.

Glenn Maynard
Received on Saturday, 30 April 2011 11:05:05 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:05 UTC