Firefox treating HTML page as download

A friend reported to me he was having this issue. A PHP generated HTML page that displayed properly on Internet Explorer would not display at all on Firefox - instead the browser would offer to download the page as if it was a zip or something.

I immediately told him that this looked like an HTTP header issue (specifically, Content-Type probably being set to application/octet-stream instead of text/html). In this case, IE gives precedence to the file's filename extension for deciding how to deal with the file; firefox/mozilla, however, gives precedence to the HTTP header, hence the difference in behavior.

This article here gives some depth, under "Firefox Displays Wrong - Browser ABC Displays Correctly ": http://kb.mozillazine.org/File_types_and_download_actions

Obviously, one would want to peek at the HTTP header in order to make sure this is indeed the problem; but how can you do that without having to install (perhaps, not having the permissions to do so) something like fiddler2? There is a cool online tool that does exactly that for you here. I would guess it is not the only one either.

Using the online tool I got the following response and confirmation of my theory:

HTTP/1.1 200 OK
Content-Length: 6075
Content-Type: application/octet-stream
Content-Location: http://whatever.com/test.php
Last-Modified: Tue, 07 Oct 2008 18:33:11 GMT
Accept-Ranges: bytes
ETag: "3d94bc26ab28c91:f09"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Tue, 07 Oct 2008 23:54:23 GMT
Connection: close

BTW, fiddler2 is highly recommended!

Post new comment

The content of this field is kept private and will not be shown publicly.

Share

  submit to reddit