MIME Type dilemma

Source: Internet
Author: User
Tags rfc

Everything starts from a bad browser and it does not support XHTML at all.

What is MIME Type?

Why? 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 do browsers distinguish them, and what is the absolute content 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.

What is the difference between processing XHTML and HTML in a browser?

The syntax of HTML is too casual. There are many shorthand for the complexity of tag mismatch, at the same time, the Web has developed over a long period of time and accumulated a lot of incorrect usage-for example, a document is not marked at all-but the browser still has to support it, as you can imagine, in order to support these "Tag Soup"-that is, the ones we call, the labels that mess up a pot of porridge-the browser needs to guess the meaning of a Tag, try to express it in the form of user expectation. In a word, although HTML 4.01 allows you to use semantic, structured, and separated content and representation to write tags, because it follows the HTML format, this makes it difficult for the browser to process all files whose MIME Type is "text/html", which is detrimental to the development of Web.

In addition to browsers, there are many other user agents who want to read HTML: Plain text browsing tools and screen readers.

A large part of the reason for creating XHTML is that it is necessary to re-strictly standardize the tags through XML, so that these user proxies can parse these tags in a simpler way. Therefore, the new format of XHTML requires that the content publisher strictly mark their own documents.

Of course, XHTML is also good for content providers. It is not described here. For details, see the following.

What is the relationship between MIME Type and it?

By combining the content of the first two sections, you can clearly find that: A browser that normally supports XHTML will distinguish whether the obtained content is html or xhtml based on the MIME Type provided by the server, text, HTML, application, XHTML, and xml, the document is parsed in two different ways. The latter resolution is much stricter, but it is of great benefit to both the user agent developer and the content provider.

Which browsers normally support XHTML? The answer is Mozilla, Mozilla-based browsers such as Netscape 7 and Firefox, and newer versions of Opera and Safari.

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.