I've seen it on all manner of website, with all manner of professional graphic artistry surrounding it, and I'd like to set the record straight: this instruction is a completely unnecessary inconvenience to the user.
The UI complaints against the action are obvious: we're asking the user to interact in a completely unintuitive way to do something they expect to be straight forward. "Click link, receive file" is the user's instinct, and the extra, awkward step can only trip them up. This isn't news; nobody wants their site to work this way. The problem is nobody is communicating that there is a better alternative.
Suppose we have a site with a large number of movies/documents/text files/et cetera in a downloads folder that we'd like to make sure always get offered to the user as a download rather than content in the browser window. All we need is a little Apache configuration like so:
<Directory>
Header set Content-Disposition attachment
</Directory>
Now anything served out of that folder will prompt the user for a download location and be saved to their hard drive by the browser. It works just about everywhere. Even IE mostly gets it right (one exception and more configuration examples here).
For web application writers, just add "Content-Disposition: attachment" to your headers by whatever means your language/framework of choice prefers when you want your generated page to be downloaded rather than displayed.
This has been here for over a decade and people still don't seem to have figured it out. Tell your friends! Stop abusing your users! Together, we can end poor understanding of HTTP features.
1 comments:
Thank you for the excellent article.
Alas, this is not foolproof. Links sent via email to such documents fail in certain mail readers beginning with the letter O.
Post a Comment