views:

49

answers:

2

I'm getting an error reading one of my JavaScript files ("Resource interpreted as script but transferred with MIME type text/html.") from Google Chrome. The other three JS files that my page calls load just fine, and I'm confused about what is causing this problem since they are all marked up in exactly the same way (and each has a "type=text/javascript" attribute). Safari and Firefox both have no problem reading all four JS files. Can anyone give me a tip on how to troubleshoot this properly? Thanks for any help!

A: 

It looks like one of your JavaScript files is not being sent with the correct Content-type header. The type attribute specified in the script tag won't have an effect here - it's the script file's header that counts.

My guess would be it has a non-standard extension (e.g. .php or .asp) that causes your server to send a different MIME type that that for .js files.

Pekka
The file in question has a .js extension.. Is the script file's header somehow altered by the server, and should I be looking at the server's settings? The file in question is David Desandro's jQuery Masonry script, and I haven't changed it in any way.
Sergio1132
@Sergio strange. Can you confirm the `Content-type` header sent for each script file e.g. using Firebug? Other than that, @dekomote's explanation makes sense, but I'd like to see some sources for that before I believe it
Pekka
@Pekka Well, strangely enough I'm having trouble in Firefox now too, although it was working fine all morning. I'm pretty sure it is an issue with the server's settings, I'm now getting a 403 Forbidden error for that particular script file. :P Have to leave the computer for now, but thanks for the helpful comments.
Sergio1132
A: 

I think that this is a webkit bug. I don't think you can troubleshoot this.

dekomote
It works fine in Safari's webkit implementation... But then, I'm not well-versed in how the implementations differ between the two browsers.
Sergio1132
Any sources for this? ` `
Pekka