Javascript – Debug message “Resource interpreted as other but transferred with MIME type application/javascript”

apachejavascriptmime-typessafari

OK, I understand what the messages means, but I'm really not sure what's causing it. I'm using Safari and the Web Inspector on Mac OS X, by the way.

I've got the following in my document head:

<script src="http://local.url/a/js/jquery.js" type="text/javascript"></script>
<script src="http://local.url/a/js/jquery.inplace.js" type="text/javascript"></script>

jquery.js is handled fine, but the other file causes the warning. It also seems that the javascript in this file never gets executed.

The file is being served via mod_deflate, so it is gzip encoded, but so is the other file.

Has anybody got any ideas what's causing this, or how to resolve it?

Cheers all,
Gaz.

Best Answer

An image with an empty "src" attribute generates this error under Windows-Chrome:

<img src="">

... whereas ...

<img>

... does not.

I arrived here because my ajax resultset was returning "src" data which was empty yet the img was still being inserted into the page.