Programmer345
Programmer345

Reputation: 580

Resource interpreted as Stylesheet but transferred with MIME type text/html error in console

I am trying to include flexslider in my Angular App and getting a following error after i included the flexslider css file

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/controlpanel/users/css/style.css". 

I checked to see if my file location was not correct but it is correct

Upvotes: 0

Views: 3756

Answers (2)

Amar
Amar

Reputation: 61

I've faced the same issue. Well, I was just trying to use a servlet to load welcome jsp page, which contains a .css file in header.

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

And I got the same error "Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/webapp/css/style.css"

When I used developer tools in chrome, under 'Network' tab, two calls were made when hit my webapp's landing url "http://localhost:8080/webapp/"

I changed my default servlet url from "/" to "/index" in web.xml

<servlet-mapping>
    <servlet-name>NextServlet</servlet-name>
    <url-pattern>/index</url-pattern>
</servlet-mapping>

And then added "./" to href,

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

It worked.

Upvotes: 1

recursive
recursive

Reputation: 86084

Your web server is not serving the resource using the correct Content-Type in the HTTP header. Your web server should have a setting for MIME types by file extensions, but that depends what server you are using.

Upvotes: 1

Related Questions