Determine the mime type when downloading a file

3

I want to view the mime type when I am downloading a file. How can I do this? (I am using Firefox at the moment, but I can download another browser if necessary)

Casebash

Posted 2011-05-17T02:12:56.740

Reputation: 5 677

Answers

6

The mime type is communicated in the "Content-Type" HTTP Header sent in the response from the web server. There are numerous ways to grab HTTP Headers (and all parts of the request/response process).

My favorite and a very popular addon for Firefox is Firebug. Look in the "Net" panel of Firebug while loading a page. You'll see entries for every asset that Firefox loads (the webpage itself, images, CSS files, etc). Click on the entry to expand it and look under "Response Headers".

Another addon is LiveHTTPHeaders. Where Firebug may miss the actual file download, this one should catch it because it dumps out all the headers into a log window. Given how many assets can load for a single page, this log window can quickly be overwhelming.

HttpFox improves on this with a log window display that lists each asset request on a single line; click the line for full detail. The window still fills quickly but there are three columns that help considerably - type, size, url. Column sorting would be a nice feature; without it's a bit of a hunt-n-peck to find the line that corresponds with the actual download but still not too bad. Though Firebug is awesome for so many things, try HttpFox first.

To be technical and nit-picky though, 'downloading' is a specific way that a web browser handles a server response. Firefox is 'downloading' the HTML of a webpage, it just doesn't look like it because Firefox renders and displays it for you. When you right-click "Save Link As" you are specifically telling the browser to download whatever is there. Certain Content-Type headers will typically trigger a browser into 'download' mode (i.e. giving you a Save dialog box). Here are two common ones: application/download and application/octet-stream.

JCotton

Posted 2011-05-17T02:12:56.740

Reputation: 569

How does HttpFox work? – Alex – 2017-09-27T10:08:39.710

Updated comment: Firebug displays lots of headers in its "Net" panel, but shows nothing when I download a file. LiveHTTP headers can find the header in two ways. One is by looking at the "Headers" tab in page info, which will actually show the headers for the download after you have initiated one, rather than the headers for the page. You can also open a Live HTTP Headers log for all windows from your tools menu, but this will show headers from ALL pages – Casebash – 2011-05-17T04:30:15.077

updated the answer. I learned more about LiveHttpHeaders different modes. Even so I think HttpFox is better for your specific task. It's easier to sort through all the various many requests. – JCotton – 2011-05-17T04:52:15.877