How To Raise a “File Download” Dialog Box for a Known MIME Type

Have you even clicked on a link and instead of going to the page your browser asks you what program you want to use to view an HTML file? Or any other file format you browser should normally handle without prompting you.

Well, for a short period of time, I actually wanted this effect for my own website.

After some searching it turns out the answer is to simply send “Content-Disposition: attachment” in your HTTP headers.

Comments are closed.