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

Kornel Lesiński kornel at geekhood.net
Mon Aug 2 09:53:24 PDT 2010


On 2 Aug 2010, at 17:21, Michael Kozakewich wrote:

>>> Dennis wrote:
>> Yes, but that wouldn't help since I want to force downloads regardless
>> of the browser settings. Maybe it would do if the type was set to
>> application/octet-stream, since those, by default, always get downloaded.
> 
> People don't often like it when they're forced to do something. If they want
> to download it, they can select "Save Link As..." from their browser. If
> they actually want to view it full-screen, they don't want to be forced to
> download it.
> 
> I see where you're coming from, but we try not to force users to do things.
> For the same reason, @target was removed from links.

I agree that it's not good to force users in general. However, this attribute can be implemented only as a hint for browsers to display Open/Save dialog. Users wouldn't be forced to download the file, it would just be easier for them to download.

OTOH users may be annoyed when their browser isn't saving some types of documents by default (and whether certain type of file should be viewed inline or saved might depend on context, e.g., I may want to read PDF booklets in the browser, but would prefer to save PDF receipts and tickets).

If Content-Disposition was attribute on <a>, then webmasters could easily offer right option (or both) where it makes sense.

Downloads can be "forced" already with Content-Disposition: attachment. It's just harder to do, and unfortunately that doesn't stop webmasters from trying. Popular PHP snippets for forcing download are among the most disgusting cargo-cult code I've ever seen — they're collection of self-contradictory and nonsensical HTTP headers, break caching and resuming, and often have security vulnerabilities.

It would be great if we could obsolete those scripts.

-- 
regards, Kornel




More information about the whatwg mailing list