I am writing a web based files administrator. How can I have an html file be downloaded when its link is clicked instead of displayed.
+6
A:
On server side, when serving file, add this header:
Content-Disposition: attachment; filename="document.html"
For examle in PHP you'd do:
header('Content-Disposition: attachment; filename="document.html"');
Pēteris Caune
2009-09-24 14:27:24
A:
Set the Content-Type header on your HTTP response to 'application/octet-stream'.
In ASP.net/C#
Response.ContentType = "application/octet-stream";
Ryan Michela
2009-09-24 14:28:28
A:
The server would need to return a different MIME Type when that file is requested such as application/octet-stream.
Oliver Weichhold
2009-09-24 14:28:40
A:
In the response headers, set Content-Disposition to "attachment; filename=something.html"
hrnt
2009-09-24 14:30:37