HTTP Header to Force Browser Download

A content disposition header can be used to tell web browsers to ask the user where they want to save the file (and download it) instead of actually opening the file in a browser tab/window. Very handy if you want to have a download button.

Content-Disposition: attachment; filename="filename.mp3"

Tested in: Firefox, Safari, IE, Opera, and Google Chrome

Leave a Reply

Your email address will not be published. Required fields are marked *