Wednesday, August 02, 2006

Content-disposition: Attachment

Best of all, prevent the browser from opening the document in the first place. Instead offer users the choice to save the file on their hard disk or to open it in its native application (Adobe Reader for PDF, PowerPoint for slides, etc.). Unfortunately, doing so requires a bit of technical trickery: you have to add an extra HTTP header to the transmission of the offending file. The header line to be added is "Content-disposition: Attachment". If possible, also add "; filename=somefile.pdf" at the end of this line, to give the browser an explicit filename if the user chooses to save the file.

 

http://www.useit.com/alertbox/open_new_windows.html

 

Tony

 

No comments:

Be A Developer That Uses AI

Developers will not be replaced by AI, they'll be replaced by developers that use AI. Generative AI tools are revolutionizing the way de...