• Register
0 votes
253 views

Problem :

I have below problem. Chrome continues to return below error

“Resource interpreted as stylesheet but transferred with MIME type text/html”

My files affected by above error are just a Style, chosen and jquery-gentleselect (other CSS files that are imported in a index in a same way work well and without error). I have already checked the MIME type and text/css is already on a CSS.

How to resolve my error?

7 5 2
3,870 points

2 Answers

0 votes

Solution :

I would like to start by understanding a problem

Browsers make the HTTP requests to servers. A server then makes the HTTP response.

Both the requests and responses consist of the bunch of headers and the (sometimes optional) body with the some content in it.

If there is the body, then one of a headers is a Content-Type which describes what a body is (is it the HTML document? the image? Your contents of the form submission? etc).

When you ask for the stylesheet, the server is telling a browser that it is the HTML document (Content-Type: text/html) instead of the stylesheet (Content-Type: text/css).

I have already checked the MIME.type and text/css is already on a css.

Then something else about the server is making that the stylesheet come with a wrong content type. Use a Net tab of your browser's developer tools to examine your request and your response.

9 7 4
38,600 points
0 votes

Solution:

Browsers creates HTTP requests to servers. The server then creates an HTTP response

Both requests and responses consist of a bunch of headers and a  body with some content in it.

In case there is a body, then one of the headers is the Content-Type which narrate what the body is (is it an HTML document? An image? The contents of a form submission? etc).

At the time you inquire for your stylesheet, your server is saying the browser that it is an HTML document (Content-Type: text/html) instead of a stylesheet (Content-Type: text/css).

I've formerly checked my myme.type and text/css is already on css.

Then something else regarding your server is creating that stylesheet come with the wrong content type.

Employ the Net tab of your browser's developer tools to test the request and the response.

Employing Angular

The base tag requires to not only be in the head however in the right location.

I had my base tag in the wrong place in the head, it must come before any tags with url requests. Originally placing it as the second tag underneath the title solved it for me.

<base href="/">

Add a forward slash / before the path to the css file, like so:

<link rel="stylesheet" href="/css/bootstrap.min.css">
Try this <link rel="stylesheet" type="text/css" href="../##/yourcss.css">

where ## is your folder wherein is your .CSS - file

Don't forget about the: .. (double dots).

reason by lines in my HTML in the following form:

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

The problem was solved at the time I removed rel="stylesheet" from the tag.

10 6 4
31,120 points

Related questions

0 votes
1 answer 1.4K views
1.4K views
Problem : Chrome is not redirecting, nor it is changing my previous page, it is just report the below warning in my console: &ldquo;Resource interpreted as Document but transferred with MIME type application/zip.&rdquo; The above process works correctly in my Firefox, and also it works ... the http://0.0.0.0:xxxx/files/download.zip. Am I doing anything wrong here, or is this the bug with Chrome?
asked Jan 4 alecxe 7.5k points
1 vote
1 answer 59 views
59 views
Problem : With the Chrome 12.0.742.112, if I redirect then the Chrome will not redirect, nor it will change your previous page, it will just report with the below warning in your console: Resource interpreted as Document but transferred with MIME type application/zip. The process ... the http://0.0.0.0:3000/files/download.zip. Am I doing something wrong here, or is this the problem with Chrome?
asked Dec 28, 2019 alecxe 7.5k points
0 votes
1 answer 86 views
86 views
Problem : I have the javascript application and when I try to run it on firefox I am facing the below error on the console: &ldquo;Because its mime type ('text/html') is not a supported stylesheet mime type&rdquo; Now I am completely confused because of this error. Kindly somebody let me know how can I resolve my above error?
asked Jan 29 jwilliam 3.9k points
0 votes
1 answer 78 views
78 views
Problem : I have the below snippet, which currently using the jQuery Form plugin to post the form to the server in the Ajax. var myoptions = { dataType: "json", success: function(data) { alert("My success"); } }; $form.ajaxSubmit(myoptions); My Ajax implementation is ... /json in the Chrome Developer Tools. I want to really find out why the warning is shown, or find a way to quickly resolve it.
asked Dec 28, 2019 alecxe 7.5k points