IE9 CSS is ignored due to MIME type mismatch problem related answer

Source: Internet
Author: User

When you write the page in Chrome,fireforks and other pages on the display of normal, but replaced by IE9 after completely no style. IE is a wonderful freak. Its error message is ' CSS is ignored because of Mime type mismatch ', which means that all of the. css files are all out of effect. Went to the internet to look up some information, there are many answers related to this question.

The first thing to understand is what the mine type is. MIME type is the type of file that sets a specified extension to open with an application, and when the file is accessed, the browser automatically opens with the specified application, specifying some client-defined file names and how some media files are opened. The main related is the Web.xml file. Web.xml is a very important configuration file in a network program. When a Web project is started, the Web container reads its configuration file web.xml, reading <listener> and <context-param> these two nodes.

In the new security mechanism of IE9, it is required that the HTTP header information returned by the Web server content-type must specify the mime-type of the CSS file as ' text/css ', otherwise IE9 will not treat it as a CSS file. If you want IE9 to display CSS file-defined styles correctly, you need to modify the corresponding MIME type in the HTTP header header information for the CSS file returned to the client by the server side.

How to modify the returned CSS MIME information:

There are different ways to fix the return MIME information of a CSS file, one is to modify the server configuration or server program, and to export the correct mine header information for the CSS file. This to the IIS settings to operate, for their own server is feasible, but for the use of virtual host of the webmaster is not and easy to do, here is not to elaborate.

Another alternative approach is to require the server to output the correct CSS mine information by configuring the Web.xml file.

Add content to Web.xml:

Copy Code code as follows:


&lt;mime-mapping&gt;


&lt;extension&gt;css&lt;/extension&gt;


&lt;mime-type&gt;text/css&lt;/mime-type&gt;


&lt;/mime-mapping&gt;
Related Article

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.