14

Sorry if this is actual duplicate but I haven't managed to find answer for my problem.

I load the script with jQuery's $.getScript. But it causes the following error:

Resource interpreted as script but transferred with MIME type text/html.

The problem appears only in Safari under Mac OS

If to look on headers received from the server, they contain Content-Type:application/x-javascript, so I really don't understand what the problem is.

DixonD
  • 6,557
  • 5
  • 31
  • 52
  • Yes, but unluckily I cannot get you link:( – DixonD Mar 19 '11 at 16:05
  • Could you recreate the problem on http://jsfiddle.net/ so that we can better follow? – shinkou Jul 23 '12 at 03:00
  • Possible duplicate of: **[Chrome says “Resource interpreted as script but transferred with MIME type text/plain.”, what gives?](http://stackoverflow.com/questions/3467404/chrome-says-resource-interpreted-as-script-but-transferred-with-mime-type-text)** – hippietrail Aug 10 '12 at 15:30

2 Answers2

9

Resource interpreted as script but transferred with MIME type text/html.

Technically that's not an error but a notice / warning and should not cause any issues in particular; if anything it's a good indication that some browsers may choose to ignore such a response.

The correct Content-Type response header for JavaScript according to the RFC is:

Content-Type: application/javascript

Previous values of text/javascript and application/x-javascript are either obsolete or deprecated respectively; that said, IE <= 8 will only accept the former so be careful when making any changes to your documents.

Ja͢ck
  • 170,779
  • 38
  • 263
  • 309
7

I had same issue and it was caused by Web.Config authorization block, I had to add an entry in Web.Config to make this script available also when not logged in:

<location path="Scripts/jquery-2.0.3.min.js">
  <system.web>
    <authorization>
      <allow users="*"/>
    </authorization>
  </system.web>
</location>
K. Weber
  • 2,643
  • 5
  • 45
  • 77