What is the difference between text/html and Text/plain?

Source: Internet
Author: User

MIME is the primary method by which the server notifies the client of what type of file to transfer, and the client browser tells the server its parameters through mime.

On the web, if the received file does not have a MIME header, it defaults to HTML format. But this is not good, because when the MIME header is Text/plain, the browser will display directly without concern for its font, color and other parameters

The role of Response.setcontenttype () is to enable the client browser to distinguish between different kinds of data and to process the corresponding data according to different MIME calls within the browser to the different programs embedded in the module.

Case "Doc": ContentType = "Application/msword"; Bre
Case "Doc":
ContentType = "Application/msword";
Break
Case "PDF":
ContentType = "Application/pdf";
Break
Case "JPG":
Case "JPEG":
ContentType = "Image/jpeg";
Break
Case "GIF":
ContentType = "Image/gif";
Break
Case "Zip":
ContentType = "Application/zip";
Break
Case "TXT":
ContentType = "Text/plain";
Break
Case "htm":
Case "HTML":
ContentType = "text/html";
Break
Case "XLS":
ContentType = "application/vnd.ms-excel";
Break
Case "ppt":
ContentType = "Application/vnd.ms-powerpoint";
Break
Default
ContentType = "Application/octet-stream";
Break
It means the octal file update, which is the update file for Firefox.




Concepts to understand

Content-type: Defines how the user's browser or related device Displays the data that will be loaded, or how to handle the data that will be loaded

The Mime:mime type is the type of file that sets an extension that is opened by an application, and the browser automatically opens with the specified application when the extension file is accessed. Many are used to specify some client-customized file names, as well as some ways to open media files.

Text/html means that the content-type of the file is set to the form of text/html, and the browser automatically calls the HTML parser to process the file when it obtains the file.

Text/plain means that the file is formatted as plain text, and the browser does not process the file when it obtains it.

What is the difference between text/html and Text/plain?

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.