Internet Explorer "CSS Was Ignored Due to Mime Type Mismatch" on Local Files (No Server)

Internet Explorer CSS was ignored due to mime type mismatch on local files (no server)

Found out the issue by testing on a few different machines, it turns out if you have a CSS file set to open with a particular program, it will prevent IE from loading, and will give the above error message -_-

Also mitigating the potential problem by including a CDN version of the CSS at the end of the file (the report has to work with and without internet)

SEC7113: CSS was ignored due to mime type mismatch

Ok,

I found that there's no way of doing from server side [tomcat] and tried with web.xml too.
Then I found a workaround using a Filter Implementation

   @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
if(request.getHeader("accept")!=null && request.getHeader("accept").contains("css")){
response.setHeader("Content-Type", "text/css");
}
chain.doFilter(req, response);
}

I explicitly set text/css for css requests. Then it's working fine.

CSS was ignored due to mime type mismatch

I figured it out, the company I just started working for failed to install the Static Content features for the IIS when setting up my computer. So it was ignoring all my style sheets, images, and links.

CSS file blocked: MIME type mismatch (X-Content-Type-Options: nosniff)

I just ran into the same issue. It appears to be a quirk of Express that can manifest itself for a few different reasons, judging by the number of hits from searching the web for "nodejs express css mime type".

Despite the type="text/css" attribute we put in our <link elements, Express is returning the CSS file as

Content-Type: "text/html; charset=utf-8"

whereas it really should be returning it as

Content-Type: "text/css"

For me, the quick and dirty workaround was to simply remove the rel= attribute, i.e., change

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

to

<link type="text/css" href="styles.css">

Testing confirmed that the CSS file was downloaded and the styles did actually work, and that was good enough for my purposes.

CSS not working in Django admin: The resource from [css file url] was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff

I got the error

Refused to apply style from '' because its MIME type
('text/html') is not a supported stylesheet MIME type, and strict MIME
checking is enabled.

because one of my Cloudflare manually created firewall rules blocked CSS URLs.
I discovered this when opened my Cloudflare dashboard and sow that firewall rule was applying 'JS challenge' to the URLs like https://[my-website]/static/admin/css/.

So if your website can not load some resources and you get the error about MIME type please check your Cloudflare dashboard or try to temporary disable it.

IE10 local page won't open CSS

I found it!

It's OK to use the Control Panel "Default Programs / Associate a file type..." to set .css files to be opened by Notetab Light (my favorite general-purpose text editor). However, if you go into Notetab Light itself and choose View, Options, Associations, and add css to the list, this generates the error I've been seeing.

Apparently, this is producing a registry entry that causes IE10 to be unable to open a local CSS file when it's called from an HTML page. IE9 wasn't afflicted by this (I never had a problem before, and I've been using Notetab Light for ages).



Related Topics



Leave a reply



Submit