Reputation: 4102
I have been reading about how to build plug-ins and this "MIME type" keeps getting discussed in it. I have tried to look into it and know that it is Multipurpose Internet Mail Extensions (MIME) but no suitable explanation of how it relates to browser plug-ins, as in what I need to know about it for building plug-ins, is provided, please explain in clear and simple words. What is it? Why do plug-ins have a MIME type?
Upvotes: 367
Views: 258447
Reputation: 1
A MIME type (Multipurpose Internet Mail Extensions) is a label used to indicate the type of data contained in a file or served by a network protocol. It is a standardized way to classify content on the internet. MIME types are typically composed of two parts: a primary type and a subtype, separated by a slash (/). For example, "text/plain" represents plain text files, while "image/jpeg" indicates JPEG image files. These labels are used by web servers to determine how to handle and process files, and by web browsers to determine how to display or handle content received from a server.
Upvotes: 0
Reputation: 943089
A MIME type is a label used to identify a type of data. It is used so software can know how to handle the data. It serves the same purpose on the Internet that file extensions do on Microsoft Windows.
So if a server says "This is text/html" the client can go "Ah, this is an HTML document, I can render that internally", while if the server says "This is application/pdf" the client can go "Ah, I need to launch the FoxIt PDF Reader plugin that the user has installed and that has registered itself as the application/pdf handler."
You'll most commonly find them in the headers of HTTP messages (to describe the content that an HTTP server is responding with or the formatting of the data that is being POSTed in a request) and in email headers (to describe the message format and attachments).
Upvotes: 879
Reputation: 35575
Imagine someone sent you this letter:
ഹായ്, നിങ്ങൾക്ക് എങ്ങനെയുണ്ട്? ഏറ്റവും പുതിയ റിപ്പോർട്ട് എന്താണ്?
What does it mean? ¯\(ツ)/¯ Consider the steps involved:
Language: Malayalam (see translation link) ഹായ്, നിങ്ങൾക്ക് എങ്ങനെയുണ്ട്? ഏറ്റവും പുതിയ റിപ്പോർട്ട് എന്താണ്??
Now, the language is identified up-front (Malayalam, not Tamil), and is written on the letter. Half the work is done, and you can proceed to decode it.
Because there are different data formats, specifying them up front allows the corresponding client to properly interpret and "render" the data, with little computational effort. Remember, computers communicate using 1s and 0s. This is effectively what happens when HTML is sent to you:
MIME TYPE: MP3 1001010101....
MIME TYPE: PDF 1001010101....
Once you know the MIME type, you can play the audio and view the PDF, with zero effort.
These analogies are not perfect but hopefully you can see the problem it was intended to solve, as well as the solution.
Upvotes: 31
Reputation: 475
It is useful to think of MIME in the context of the client-server model. Clients and servers communicate over what is known as the HTTP protocol. In an HTTP request or response, we can have a body. The Content-Type or MIME type specifies what is the type of the body, like text/javascript
or something else like audio, video, etc.
However, MIME types are not limited just to HTTP.
As the name suggests, MIME stands for Multipurpose Internet Mail Extensions. Originally, SMTP only supported ASCII-encodings. However, there as a need for more. We could use MIME to slap a label on the content being transmitted or received.
Upvotes: -1
Reputation: 49974
I couldn't possibly explain it better than Wikipedia does in Media type:
In addition to e-mail applications, Web browsers also support various MIME types. This enables the browser to display or output files that are not in HTML format.
In other words, it helps the browser (or content consumer, because it may not just be a browser) determine what content they are about to consume; this means a browser may be able to make a decision on the correct plugin to use to display content, or a media player may be able to load up the correct codec or plugin.
Upvotes: 16
Reputation: 5703
MIME stands for Multi-purpose Internet Mail Extensions. MIME types form a standard way of classifying file types on the Internet. Internet programs such as Web servers and browsers all have a list of MIME types, so that they can transfer files of the same type in the same way, no matter what operating system they are working in.
A MIME type has two parts: a type and a subtype. They are separated by a slash (/). For example, the MIME type for Microsoft Word files is application and the subtype is msword. Together, the complete MIME type is application/msword.
Although there is a complete list of MIME types, it does not list the extensions associated with the files, nor a description of the file type. This means that if you want to find the MIME type for a certain kind of file, it can be difficult. Sometimes you have to look through the list and make a guess as to the MIME type of the file you are concerned with.
Upvotes: 94
Reputation: 74541
MIME stands for Multipurpose Internet Mail Extensions. It's a way of identifying files on the Internet according to their nature and format.
For example, using the Content-type
header value defined in a HTTP response, the browser can open the file with the proper extension/plugin.
Internet Media Type (also Content-type) is the same as a MIME type. MIME types were originally created for emails sent using the SMTP protocol. Nowadays, this standard is used in a lot of other protocols, hence the new naming convention "Internet Media Type".
A MIME type is a string identifier composed of two parts: a type
and a subtype
.
The x-
prefix of a MIME subtype simply means that it's non-standard.
The vnd
prefix means that the MIME value is vendor specific.
Upvotes: 44