Home  >  Article  >  Web Front-end  >  What does MIME type mean in html

What does MIME type mean in html

青灯夜游
青灯夜游Original
2021-12-14 13:47:243154browse

In HTML, the MIME type refers to the Multipurpose Internet Mail Extension type, which is a type that sets a file with a certain extension to be opened by an application. When the file with the extension is accessed When the time comes, the browser will automatically use the specified application to open.

What does MIME type mean in html

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

First, we need to understand how the browser processes content. The content displayed in the browser includes HTML, XML, GIF, and Flash... So, how does the browser distinguish between them and decide what content to display in what form? The answer is MIME Type, which is the media type of the resource.

MIME(Multipurpose Internet Mail Extensions)Multipurpose Internet Mail Extensions type. It is a type of method that sets a file with a certain extension to be opened by an application. When the file with the extension is accessed, the browser will automatically use the specified application to open it.

Simply put, MIME type tells the browser what form to use to display it.

Note: Data transmission on the Internet must use MIME Type

Multimedia file format MIME

In the earliest HTTP protocol, there is no additional Data type information, all transmitted data is interpreted by the client program as a Hypertext Markup Language HTML document. In order to support multimedia data types, the HTTP protocol uses MIME data type information attached before the document to identify the data type.

MIME stands for Multipurpose Internet Mail Extensions. It was originally designed to attach multimedia data when sending emails so that the email client program can process them according to their type. However, when it is supported by the HTTP protocol, its significance becomes even more significant. It makes HTTP transfer not only ordinary text, but also rich and colorful.

Each MIME type consists of two parts. The first part is the big category of data, such as sound audio, image image, etc., and the second part defines the specific type.

Common MIME types

  • Hypertext Markup Language text.html,.html text/html

  • Normal text.txt text/plain

  • RTF text.rtf application/rtf

  • GIF graphic.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 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 special organization in the Internet called IANA Confirm standard MIME types, but the Internet is developing too fast, and many applications cannot wait for IANA to confirm that the MIME types they use are standard types. Therefore, they use methods that start with x- in the category to identify this category, which has not yet become a standard, such as: x-gzip, x-tar, etc. In fact, these types are so widely used that they have become de facto standards. As long as the client and server jointly recognize this MIME type, it doesn't matter even if it is a non-standard type. The client program can use specific processing methods to process the data based on the MIME type. In web servers and browsers (including operating systems), standard and common MIME types are set by default. Only for uncommon MIME types, it is necessary to set both the server and the client browser for identification.

Since the MIME type is related to the suffix of the document, the server uses the suffix of the document to distinguish the MIME types of different files. The correspondence between the document suffix and the MIME type must be defined in the server. When the client program receives data from the server, it only 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 program the MIME type of the data. Before the server sends the real data, it must first send the MIME type information that marks the data. This information is defined using the Content-type keyword. For example, for an HTML document, the server will first send the following two lines of MIME identification information. This identification does not Not really part of the data file.

Content-type: text/html

Note that the second line is a blank line, which is necessary. The purpose of using this blank line is to combine the MIME information with The real data content is separated.

MIME (Multipurpose Internet Mail Extensions) is an Internet standard for describing message content types.

MIME messages can contain text, images, audio, video, and other application-specific data.

Official MIME information is provided by the Internet Engineering Task Force (IETF) in the following document:

  • 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.

Recommended tutorial: "html video tutorial"

The above is the detailed content of What does MIME type mean in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn