CSS is not loaded at all in Internet Explorer (SEC

2020-02-13 17:58发布

问题:

I have an AngularJS Website, which works perfectly in every browser. But in Internet Explorer (tested with version 11) CSS is not loaded at all.

Error Code: SEC7113

Error Message: "CSS was ignored due to mime type mismatch"

Also check here: http://msdn.microsoft.com/en-us/library/hh180764(v=vs.85).aspx

This is how I include my CSS (right before ):

<link rel="stylesheet" type="text/css" href="css/app.css">

Also This is my Doctype:

<!doctype html>
<html ng-app="app">

I know for sure (100%), that it worked in Internet Explorer few weeks ago, since I tested the performance in different browser. Since then, the css changed a lot. But not the way I include the CSS.

Does anybody know, what could be the problem here? Thank you very much!

回答1:

The problem here is with an invalid mime-type for the CSS file. It's possible your CSS file is actually being sent down with a mime-type like text/plain instead of text/css. As a result, Internet Explorer prevents the file from loading so as to avoid potential attack vectors.

This problem was most notably seen when people would reference JavaScript files from GitHub, which are served with text/plain mime-types, but inteded to be used as text/javascript in the document.

Ensure that your response headers contain the text/css mime-type and you should be fine. This information is available in the F12 Developer Tools under the Network panel.