Debug message "Resource interpreted as other but transferred with MIME type application/javascript"

104,944

Solution 1

seems to be a bug in safari / webkit. maybe this one, or any of these. try upgrading your safari. if there is no more recent stable version, try the 4 beta.

Solution 2

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.

Solution 3

Solved!

I have had this error for several days. It was driving me crazy because it didnt allow me to use firefox firebug's script debugger. Finally, my error was solved when I removed an empty url in a "background-image: url()" style property.

This has been so much a pain than I really hope somebody can use this advice.

Solution 4

I don't think it is a bug, Try adding the MIME type to your .htaccess file For instance, put or add the following content to your .htaccess file (which should be in the same place of your .js or above folders)

#JavaScript
AddType application/x-javascript .js

This solved my tree "Resource interpreted as other but transfered ... " warnings. Everytime you have that kind of warning it means you don't have enough info in your .htaccess file.

BTW1: Since you are modifying .htaccess file, make sure you restart your server.

BTW2: I also could clear same warnings for GIF files in Safari 4 with this:

#GIF
AddType image/gif .gif

BTW3: For other file types: see w3schools list or htaccess-guide

Solution 5

You need to use a tool to view the HTTP headers sent with the file, something like LiveHTTPHeaders or HTTPFox are what I use. If the files are sent from the webserver without a MIME type, or with a default MIME type like text/plain, that might be what this error is about.

Share:
104,944
Gaz
Author by

Gaz

Mobile and web developer, Bristol, UK. Director at Red Robot, http://red-robot.co.uk.

Updated on July 08, 2022

Comments

  • Gaz
    Gaz almost 2 years

    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.

  • maxfridbe
    maxfridbe over 13 years
    This was exactly the case for me.
  • Liam
    Liam over 13 years
    You don't need to restart your server after modifying .htaccess.
  • kingmaple
    kingmaple over 12 years
    Yeah there's a bug when using Last-Modified in WebKit browsers. They seem to get confused about any static file when you send that header.
  • Ben Laniado
    Ben Laniado about 12 years
    look at the next answer that actually solve the problem. This can be explained because src ="" goes to fetch the current page as the image. if you have src ="" just remove the src property
  • Dan Dascalescu
    Dan Dascalescu over 11 years
    This was a pain to debug, until I just searched from the error string on SO. The error came from a Wordpress theme, ProMotion, that simply outputted whatever the user typed in as a background image URL. Most of the time, there was no background image URL typed in.
  • John Mee
    John Mee over 11 years
    @DanDascalescu reports url() - ie no src address - in your CSS or javascript is effectively the same thing and generates the same error. especially: background-image: url()