DEV Community

Discussion on: Had to use browser detection like its 1999

Collapse
 
kspeakman profile image
Kasey Speakman • Edited

Good question. In the post I jokingly said that it's just easier not to do things. But I will give actual reasons.

MIME types and file extensions serve exactly the same purpose. However, MIME types are gone after the transfer is done. But sitting on the user's hard drive, the file extension will still continue to indicate the type of file and what program opens it.

To provide the MIME type, I would have to bring in a dependency (and a chunk of memory) to map the file extension to MIME type. And it's redundant information since the browser and/or OS already know how to handle file extensions.

MIME types would be useful in cases where I was streaming amorphous data. Or in cases where I am using non-standard or absent file extensions to transmit data, especially if it is meant to be displayed in browser or email. For example, serving a webpage without .html on the end. Common example GET somesite.com/about

I referred to MIME Type as Media Type in my post. Since the W3C decided they didn't like "MIME"s.