Refused to apply style from... because its MIME type ('text/html') is not a supported style-sheet MIME type, and strict MIME checking is enabled
51,298
Solution 1
Stylesheets should have a MIME type of text/css
. Your server is serving up a HTML document (probably a 404 NOT FOUND error page) when it should be serving a CSS document.
Solution 2
Solution:
In my case, the problem was an empty @GetMapping
in one of my Controllers. I deleted it and the problem was gone.
I think the same answer will help someone who's having this similar problem and context ; e.g. JSP.
Background:
I had the same problem using Spring Boot and FreeMaker.
Author by
praval
JavaScript | React | React-Native | Web-Developer | Mobile App Developer
Updated on July 09, 2022Comments
-
praval almost 2 years
This error shows only in chrome. I am searching this issue but not yet found any
satisfactory solution.I attached a screenshot of that error. Please suggest some idea for this. Error image -
praval about 6 yearsThanks can you give some idea how to change MIME type in MVC .net application.
-
Jordan about 6 yearsHi, I tried this and found that it didn't have any effect, but changing the src attribute did, as per my answer below. Do you have any thoughts as to why this may be the case? Thanks.
-
Alohci about 6 years@Jordan. The two urls clearly resolve to different locations, Regardless of what the current folder is. the relative url has the "css" folder inside the "public" folder, while the absolute url doesn't. If this doesn't satisfy you, you should ask a new question.
-
Jordan about 6 years@Alohci yes that was just the way I typed them in - the paths are correct in the actual code.
-
Olu Adeyemo about 4 yearsYou should provide more explanation. The one you gave is not really helpful.
-
Willie Cheng almost 4 yearsThis does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review
-
Fox2k almost 4 yearsIt's really answer, I searched for this answer for 3 days, re-reading a bunch of topics with a similar error and not where this solution was not directly written. Although there were short explanations of why this could happen, it is because, in my case, the empty @GetMapping overrides servlet by default and the browser receives in the response not CSS but something else with MIME type text/html, but this is not obvious from the error.