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, 9 Apr 2011 22:19:49 -0400
Message-ID: <BANLkTim_MKjPDO8iQMHF+SabNzHLLcz30Q@mail.gmail.com>
> http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-July/027455.html

A big +1 to the proposal in this thread, to allow specifying
Content-Disposition behavior in anchors.  <a download=filename.txt> would
have the effect of adding (or overriding) the header "Content-Disposition:
attachment; filename=filename.txt".

It would mean I'd no longer need to use server-side hacks to cause
Content-Disposition to be sent for download links, eg. where "?download=1"
adds the C-D header.

I also just now had to implement a server-side script that receives base64
file data and a filename in parameters, and responds by echoing it back.
That's an ugly hack to allow client-side data to be saved to disk, and
doesn't work with serverless web apps.  This would be fixed, allowing both
data: URLs and File API object URLs as download links.

There was a related proposal here, but it only covers data URIs; the <a
download> approach is simpler and much more useful.
http://lists.w3.org/Archives/Public/uri/2010Feb/0058.html

-- 
Glenn Maynard
Received on Saturday, 9 April 2011 19:19:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:03 GMT