MIME Type, mimetype

Source: Internet
Author: User

MIME Type, mimetype

First, we need to know how the browser handles the content. The content displayed in the browser includes HTML, XML, GIF, and Flash ...... Then, how does a browser differentiate them and decide what content is displayed in what form? The answer is MIME Type, which is the media Type of the resource.

The media Type is usually notified to the browser through the HTTP protocol. More accurately, it is expressed by Content-Type, for example:

Content-Type: text/HTML


Indicates that the content is of the text/HTML type, that is, hypertext file. Why is it "text/HTML" instead of "HTML/text" or something else? MIME Type is not specified by an individual. It is published on the Internet in the form of RFC through the ietf Organization negotiation, most Web servers and user proxies support this specification (by the way, the Type of Email attachments is also specified by MIME Type ).

Generally, only some formats that are widely used on the Internet can obtain a MIME Type. If the format is defined by a client, it can only start with application/x.

XHTML is a widely used format. Therefore, in RFC 3236, the MIME Type of the XHTML format file should be application/xHTML + XML.

Of course, when no one tells the browser about the MIME Type of a local file, the browser also performs some default processing, this may be related to the MIME Type you configured for the file in the operating system. For example, in Windows, open the "HKEY_LOCAL_MACHINESOFTWAREClassesMIMEDatabaseContent Type" primary key of the Registry, and you can see the configuration information of all MIME types.

 

II,

When sending the output result to a browser, the browser must start an appropriate application to process the output document. This can be done through multiple types of MIME (multi-function Internet Mail Extension protocol. In HTTP, the MIME Type is defined in the Content-Type header.

For example, you need to transfer a Microsoft Excel file to the client. The MIME type is "application/vnd. ms-excel ". In most cases, this file is then transmitted to Execl for processing (assuming we set Execl to an application that handles special MIME types ). In ASP, the method for setting the MIME type is through the ContentType attribute of the Response object.


Multimedia file format MIME

In the earliest HTTP protocol, there was no additional data type information. All transmitted data was interpreted by the client program as HTML documents in the hypertext markup language. to support multimedia data types, the MIME data type information appended to the document is used in the HTTP protocol to identify the data type.

MIME is an extension of multi-object Internet mail. It is designed to attach multimedia data to an email so that the mail client program can process it based on its type. However, when it is supported by the HTTP protocol, its meaning becomes more significant. It makes HTTP transmitted not only plain text, but also rich and colorful.

Each MIME type consists of two parts. The front part is a large data type, such as audio, image, and so on. The latter part defines a specific type.

Common MIME types

Hypertext markup language text .html, .html text/html
Common text. txt text/plain
RTF text. rtf application/rtf
GIF image. gif image/gif
JPEG image .ipeg,.jpg image/jpeg
Au audio file. au audio/basic
MIDI music files mid,. midi audio/midi, audio/x-midi
RealAudio music file. ra,. ram audio/x-pn-realaudio
MPEG file. mpg,. mpeg video/mpeg
AVI file. avi video/x-msvideo
GZIP file. gz application/x-gzip
TAR file. tar application/x-tar

There is a dedicated IANA organization in the Internet to confirm the standard MIME type, but the Internet is growing too fast, and many applications cannot wait for IANA to confirm that they are using the standard MIME type. Therefore, they use methods starting with x-in the category to identify this category, such as x-gzip and x-tar. In fact, these types are widely used and have become the de facto standard. As long as the client and server acknowledge this MIME type together, even if it is not a standard type, the client program can process data according to the MIME type. In Web servers and browsers (including operating systems), standard and common MIME types are set by default, the server and client browser must be set for identification.

Because the MIME type is related to the document suffix, the server uses the document suffix to distinguish the MIME types of different files. The server must define the correspondence between the document suffix and the MIME type. When a customer program receives data from the server, it only accepts data streams from the server and does not know the document name. Therefore, the server must use additional information to tell the customer program the MIME type of data. Before the server sends real data, it must first send the MIME type information of the Flag data. This information is defined using the Content-type keyword. For example, for HTML documents, the server will first send the following two lines of MIME identification information, which is not part of a real data file.

Content-type: text/html

Note that the second act is a blank line, which is required to separate the MIME information from the real data content.

MIME (Multipurpose Internet Mail Extensions) is an Internet standard that describes the message content type.
MIME messages can contain text, images, audio, video, and other application-specific data.
The official MIME information is provided by Internet Engineering Task Force (IETF) in the following documents:
RFC-822 Standard for ARPA Internet text messages

RFC-2045 MIME Part 1: Format of Internet Message Bodies

RFC-2046 MIME Part 2: Media Types

RFC-2047 MIME Part 3: Header Extensions for Non-ASCII Text

RFC-2048 MIME Part 4: Registration Procedures

RFC-2049 MIME Part 5: Conformance Criteria and Examples

Different applications support different MIME types.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.