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

Glenn Maynard glenn at zewt.org
Sat Apr 9 19:19:49 PDT 2011


> 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


More information about the whatwg mailing list