rob.m rob.m - 3 months ago 41
Javascript Question

Refused to execute script, strict MIME type checking is enabled?

Why am I getting this error in console?

Refused to execute script from
because its MIME type ('application/json') is not executable, and
strict MIME type checking is enabled.


You have a <script> element that is trying to load some external JavaScript.

The URL you have given it points to a JSON file and not a JavaScript program.

The server is correctly reporting that it is JSON so the browser is aborting with that error message instead of trying to execute the JSON as JavaScript (which would throw an error).

Odds are that the underlying reason for this is that you are trying to make an Ajax request, have hit a cross origin error and have tried to fix it by telling jQuery that you are using JSONP. This only works if the URL provides JSONP (which is a different subset of JavaScript), which this one doesn't.

The same URL with the additional query string parameter callback=the_name_of_your_callback_function does return JavaScript though.