Home > Article > Web Front-end > What to do if css is ignored due to mime type mismatch
Solutions for css being ignored due to mime type mismatch: 1. Detect the Link tag; 2. Browse the page through the http protocol; 3. Manually configure the server environment.
The operating environment of this article: Windows 7 system, Dell G3 computer, HTML5&&CSS3 version.
What is the reason for the "SEC7113: CSS was ignored due to Mime type mismatch" problem in IE browser? How to deal with it? The following article will introduce it to you. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
What are Mime types?
MIME (Multipurpose Internet Mail Extensions) multipurpose Internet mail extension type 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. It is mostly used to specify some client-defined file names and some media file opening methods.
Why does the error occur?
In IE browsers above IE9, especially in the local environment, when there is no server configuration, the CSS file of the external link will not be loaded successfully, resulting in the desired effect. Not implemented! When you encounter such a problem, you will see the error message "SEC7113: CSS ignored due to Mime type mismatch" in the console of the debugging tool that comes with IE.
Microsoft has added a file name recognition program since IE9. This will only appear in the standard mode of IE9 and above. There is no problem in the compatibility mode.
[Recommended learning: css video tutorial]
Solution
Now that we know the cause of this error, then we This problem can be solved in a targeted manner. The following contains the detection steps and methods. You can skip certain steps according to your actual situation.
1. Detect the Link tag
The Link tag is the tag we introduce into the style sheet. Check whether the type=text/css attribute is missing. Here is a complete example of the Link tag.
<link rel=stylesheet type=text/css href="style.css">
If you find that it has no effect after adding it, then read on.
2. Static pages cannot display styles
In fact, many people encounter this problem by directly using the browser to open the web page locally, that is, they do not browse the page through the http: protocol. The web page is opened through the file: protocol. CSS cannot return the correct Mime, possibly due to issues with your system.
Enter the registry editor and check whether the Content Type in HKEY_CLASSES_ROOT\.css is text/css.
3. The server environment cannot display the style.
The style cannot be displayed in the server environment. Whether it is local or remote, the solution is the same. Since the server cannot return the correct document type, We need to configure it manually.
IIS Server
For the IIS server, configure the web.xml file to require the server to output correct CSS Mine information.
<mime-mapping> <extension>css</extension> <mime-type>text/css</mime-type> </mime-mapping>
Apache Server
When the web server sends a document to the browser, it prefixes the document with a response header. This header contains information that tells the browser how to interpret the document. Data, one of the most important parts of metadata is the Content-Type in the last line. It will tell the browser how to render the content. For example, the code used by browsers to display JPEG and GIF is different.
Here we need to correctly configure the Content-Type of the CSS file. There is a conf folder in the Apache installation directory. The mime.types file inside is the response header document type configuration.
Add some code to the mime.types file, and then restart the Apache server.
text/css css
If it still doesn’t work, try adding some code to the httpd.conf file to load the mime.types configuration file.
<IfModule mime_module> TypesConfig conf/mime.types </IfModule>
The above is the detailed content of What to do if css is ignored due to mime type mismatch. For more information, please follow other related articles on the PHP Chinese website!