Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource interpreted as other but transferred with MIME type text/javascript?

I keep getting "Resource interpreted as other but transferred with MIME type text/javascript.", but everything seems to be working fine. This only seems to be happening in Safari 4 on my Mac.

I was advised to add "meta http-equiv="content-script-type" content="text/javascript" to the header, although that did nothing.

like image 310
homework Avatar asked Sep 06 '09 18:09

homework


People also ask

What is MIME type in Javascript?

MIME (Multipurpose Internet Mail Extensions) type is a standard way of describing a data type in the body of an HTTP message or email. The MIME type is passed in the Content-Type header. For example, the Content-Type: text/html header tells the browser that it received an HTML page.

What is MIME type script?

The MIME type for javascript wasn't standardized for years. It's now officially: "application/javascript". The real kicker here is that most browsers won't use that attribute anyway, at least not in the case of the script tag. They actually peek inside the packet and determine the type for themselves.

Where do I put MIME type in HTML?

Look for a <meta> element in the page source that gives the MIME type, for example <meta http-equiv="Content-Type" content="text/html"> .


3 Answers

The most common way to get the error is with the following code:

<img src="" class="blah" />

A blank url is a shortcut for the current page url, so a duplicate request is made which returns content type html. The browser is expecting an image, but instead gets html.

like image 115
jcampbell1 Avatar answered Oct 01 '22 00:10

jcampbell1


i received this error due tu a missing element which a jquery plugin tried to call via js var btnChange i commented the none needed (and non existent) images out and the warning (google chrome dev tools) was fixed:

$(mopSliderName+" .sliderCaseRight").css({backgroundImage:"url("+btnChange.src+")"});
like image 27
timo Avatar answered Oct 02 '22 00:10

timo


The (webkit-based) browser is issuing a warning that it has decided to ignore the mimetype provided by the webserver - in this case text/javascript - and is applying a different mimetype - in this case "other".

It's a warning which users can typically ignore, but a developer might find useful when looking for clues to a problem. For this example it might explain why some javascript wasn't being executed.

like image 2
John Mee Avatar answered Oct 01 '22 00:10

John Mee