[MIME] Content-type, IE, MIME, and the registry (text/plain file download)

Source: Internet
Author: User

Recently encountered a very depressing question, the general situation is as follows:

There is a Java application at hand, which has an action set response header Content-type to text/plain;charset=**, resulting in a part of the client machine access to this URL appears to run normally, but the page appears on the download.

For example, we are visiting Http://localhost/test/a.jspa, and a download box prompts you to download the A.jspa file and the file type is jspa_auto_file.

After two days of search finally to get a clue, it is the registry in the HKEY_CLASSES_ROOT item under a more than one subkey. Jspa and the value of this subkey is Jspa_auto_file.

Then I did some tests and found that only the following three conditions were met: The background Application settings response Header Content-type is a subkey with the same name as the URL suffix under HKEY_CLASSES_ROOT in the text/plain;charset=** registry. The value of the subkey is the name +_auto_file of the subkey. For example, the URL is http://localhost/a.suffix. Suffix the name of the subkey is. Suffix_auto_file The data returned is plain text

The above situation will arise.

Why, according to the information on the Web and the MSDN documentation, my guesses are as follows:

IE will automatically detect the MIME type when parsing the URL, and when encountering the Text/plain type, he will find out if there is a match under the HKEY_CLASSES_ROOT entry in the registry, and if so, it will be parsed using this value.

Also hope that the master of IE cooked advice

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.