Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Website CSS loading issue with IE and Edge

I have a website running perfectly fine on Chrome, Firefox, Safari etc. however, the CSS does not load in Internet explorer (any version) as well as in MS Edge browser.

The Console shows this infamous error related to MIME Type:

SEC7113: CSS was ignored due to mime type mismatch
File: application-2015-2a0565839ee60a029c49fc918e3625e9.css
SEC7113: CSS was ignored due to mime type mismatch
File: CustomCss.css
SEC7113: CSS was ignored due to mime type mismatch
File: print.css

I have checked in the code, and this is how it is in the <head>

// ASP.NET MVC code - .cshtml layout file
<link href='@Url.Content("/Content/application-2015-2a0565839ee60a029c49fc918e3625e9.css")' media="screen" rel="stylesheet" type="text/css"/>
<link href='@Url.Content("/Content/CustomCss.css")' media="screen" rel="stylesheet" type="text/css"/>
<link href='@Url.Content("/Content/2015/print.css")' media="print" rel="stylesheet" type="text/css"/>

I have checked in the IE Developer Tools, and the css indeed returned with incorrect MIME type (coming as blank) in IE instead of stylesheet or text/css as in Chrome or Firefox:

IE: enter image description here

Chrome: enter image description here

I have checked in IIS, the mime type for .css is mapped as expected: enter image description here

How can I make IE to understand the Mime type and let it load it correctly.

Any help is highly appreciated.

EDIT

As suggested, also checked the Registry value for .css in HKEY_CLASSES_ROOT and this seems ok as below: enter image description here

Also, ensured that no program is associated with CSS to open.

like image 658
Pankaj Gaur Avatar asked Dec 27 '16 14:12

Pankaj Gaur


1 Answers

This is because under default settings, “static content” is not installed with IIS.

To enable this on a Windows Server 2008 machine do the following

  1. Fire up Server Manager

  2. Select Web Server under Roles – notice that Static Content is not installed

enter image description here

Select Add Role Services from the right hand menu

enter image description here

Check Static content and install

i think it works for you

like image 159
dheeraj Kumar Avatar answered Oct 10 '22 18:10

dheeraj Kumar