First, we need to understand how the browser handles content. The content displayed in the browser is HTML, XML, GIF, and Flash ... So how do browsers differentiate between them and decide what form to display. The answer is the MIME type, which is the media type of the resource.
The media type is usually via the HTTP protocol, which is communicated to the browser by the WEB server and, more accurately, is represented by Content-type, for example:
Indicates that the content is a text/html type, which is a hypertext file. Why "text/html" instead of "Html/text" or something. The MIME type is not specified by the individual, and is published online as an RFC, as recommended by the IETF organization, and most WEB servers and user agents support this specification (by the way, the type of the Email attachment is also specified by the MIME type).
Usually only a few formats that have been widely applied on the internet will get a MIME Type, which, if it is a client-defined format, typically starts with a application/x-.
XHTML is a widely used format, so in RFC 3236, the MIME Type of the XHTML format file should be application/xhtml+xml.
Of course, with a local file, the browser does some default processing when no one tells the browser the MIME type of a file, which may be related to the MIME type you configured for the file in the operating system. For example, under Windows, you can see the configuration information for all MIME type by opening the "hkey_local_machinesoftwareclassesmimedatabasecontent type" PRIMARY key of the registry.
When the output is transferred to the browser, the browser must start the appropriate application to process the output document. This can be done through multiple types of MIME (multifunction Internet Mail Extensions protocol). In HTTP, the MIME type is defined in the Content-type header.
For example, set up you want to send a Microsoft Excel file to the client. Then the MIME type is "application/vnd.ms-excel". In most cases, the file will then be routed to execl for processing (assuming we set execl as an application to handle a particular MIME type). In ASP, the method of setting MIME type is through the Response object's ContentType property.
Multimedia file format MIME
In the earliest HTTP protocol, there was no additional data type information, all the transmitted data was interpreted by the client as Hypertext Markup Language HTML document, and in order to support multimedia data types, the HTTP protocol used the MIME data type information appended to the document to identify the data type.
MIME is a multi-mesh Internet Mail extension designed to provide additional multimedia data when sending e-mail messages, allowing mail clients to process them according to their type. When it is supported by the HTTP protocol, however, its significance is even more pronounced. It makes the HTTP transmission not only ordinary text, but become rich and colorful.
Each MIME type is made up of two parts, preceded by a large category of data, such as sound audio, image image, and so on, followed by the definition of a specific kind.
Common MIME Types
Hypertext Markup Language text. html,.html text/html
Plain text. txt Text/plain
RTF text. rtf Application/rtf
GIF graphics. gif image/gif
JPEG Graphics-ipeg,.jpg image/jpeg
Au sound file. Au audio/basic
Midi Music file Mid,.midi Audio/midi,audio/x-midi
RealAudio music files. RA,. Ram Audio/x-pn-realaudio
MPEG files. Mpg,.mpeg video/mpeg
AVI file. avi Video/x-msvideo
gzip files. GZ application/x-gzip
Tar file. Tar Application/x-tar
There is a dedicated organization of the IANA on the Internet to confirm standard MIME types, but the Internet is growing too fast for many applications to wait for the IANA to confirm that the MIME types they use are standard types. So they use the method of X-opening in the category to identify that the category has not yet become a standard, such as X-gzip,x-tar. The fact that these types are widely used has become a fact standard. As long as both the client and the server recognize this MIME type, even if it is not a standard type, the client program can handle the data according to the MIME type using a specific processing method. For Web servers and browsers (including the operating system), the default is to set the standard and common MIME types, and only for unusual MIME types is it necessary to set up both the server and the client browser for identification.
Because the MIME type is related to the suffix of the document, the server uses the suffix of the document to differentiate between the MIME types of the different files, and the correspondence between the document suffix and the MIME type must be defined in the server. When the client receives data from the server, it simply accepts the data stream from the server and does not know the name of the document, so the server must use additional information to tell the client the MIME type of the data. Before the server sends the real data, it sends the MIME type of the flag data, which is defined using the Content-type keyword, for example, for HTML documents, where the server first sends the following two lines of MIME identity information, which is not part of the real data file.
Note that the second act is a blank line, which is necessary to use this empty line to separate the MIME information from the real data content.
MIME (Multipurpose Internet Mail Extensions) is an Internet standard that describes the type of message content.
MIME messages can contain text, images, audio, video, and other application-specific data.
The official MIME information is provided by the Internet Engineering Task Force (IETF) in the following documentation:
RFC-822 Standard for ARPA Internet text messages
RFC-2045 MIME part 1:format to 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.