Chrome refuses to execute an AJAX script due to wrong MIME type

Asked
Active3 hr before
Viewed126 times

9 Answers

chromeexecute
90%

By adding a callback argument, you are telling jQuery that you want to make a request for JSONP using a script element instead of a request for JSON using XMLHttpRequest.,(While you are at it, stop telling jQuery that you are expecting JSON as that is contradictory: dataType: 'jsonp')., 1 I've to use ajax between two sites. Guide me about they you are talking about to set "Change your server so it outputs the right MIME type for JSONP which is application/javascript". How to do thi – Taimoor Changaiz Dec 15 '14 at 13:07 , @TaimoorChangaiz — I can't tell you that. If you are generating static files, it depends on the server you are using. If you are dynamically generating the content, it depends on the programming language (and possibly framework) you are using. Try asking a question which describes what you have so far and exactly where you are stuck. – Quentin Dec 15 '14 at 13:55

If your proxy server or container adds the following header when serving the .js file, it will force some browsers such as Chrome to perform strict checking of MIME types:

X - Content - Type - Options: nosniff
load more v
88%

Refused to execute script from '*' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.,I'm trying to access a script as JSON via AJAX, which works fine on Safari and other browsers but unfortunately will not execute in Chrome. It's coming with the following error:,Change your server so it outputs the right MIME type for JSONP which is application/javascript(While you are at it, stop telling jQuery that you are expecting JSON as that is contradictory: dataType: 'jsonp').,72750/error-chrome-refuses-execute-ajax-script-due-wrong-mime-type

Here's the request:

$.ajax({
   url: "http://some_url/test.json?callback=?",
   type: "GET",
   dataType: 'json',
   cache: true,
   success: function(data, status, error) {
      console.log('success', data);
   },
   error: function(data, status, error) {
      console.log('error', data, status, error);
   }
});
72%

Refused to execute script from '*' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.,Change your server so it outputs the right MIME type for JSONP which is application/javascript.,I encountered this error using IIS 7.0 with a custom 404 error page, although I suspect this will happen with any 404 page. The server returned an html 404 response with a text/html mime type which could not (rightly) be executed.,I faced this problem when trying to run an existing application on a new IIS 10.0 installation

Here's the request:

$.ajax({
   url: "http://some_url/test.json?callback=?",
   type: "GET",
   dataType: 'json',
   cache: true,
   success: function(data, status, error) {
      console.log('success', data);
   },
   error: function(data, status, error) {
      console.log('error', data, status, error);
   }
});
load more v
65%

am getting an below error ,Refused to execute script from ‘https://s2020293361.t.eloqu’ because its MIME type (‘text/html’) is ,https://stackoverflow.com/questions/24528211/chrome-refuses-to-execute-an-ajax-script-due-to-wrong-mime-type,still getting same error please suggest me to fix this

please help me to do this.

$.ajax({
   url: 'https://s2020293361.t.eloqua.com/e/f2?elqFormName=htmlnameofform&elqSiteID=2020293361&emailAddress=john.smith@tegrita.com&firstName=John&lastName=Smith&company=Tegrita&busPhone=12345667890&city=Toronto',
   type: 'post',
   dataType: "jsonp",
   data: formdata.serialize(),
   contentType: "application/javascript; charset=utf-8",
   success: function(msg) {
      console.log("success");
   },
   error: function(request, status, error) {
      console.log(error);
   }
});
75%

Refused to execute script from '*' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.,I'm trying to access a script as JSON via AJAX, which works fine on Safari and other browsers but unfortunately will not execute in Chrome. It's coming with the following error:,Change your server so it outputs the right MIME type for JSONP which is application/javascript.,But there is no problem in writing a script and executing that:

Here's the request:

$.ajax({
   url: "http://some_url/test.json?callback=?",
   type: "GET",
   dataType: 'json',
   cache: true,
   success: function(data, status, error) {
      console.log('success', data);
   },
   error: function(data, status, error) {
      console.log('error', data, status, error);
   }
});
load more v
40%

Let’s understand error first. It’s Chrome’s security standard not to execute which is not it meant to be.,I’m not sure when I started getting this error but I suspect, may be from beginning. Here is a complete error message:,How to add Typewriter (Typing) Animated Text Effect using Typed.js to WordPress Site – Example Attached ,Disqus WordPress plugin has a bug which downloading script as part of HTML MIME type. It should be JavaScript type.

How to fix this Disqus error?

Fix is very simple. We just have to add below statement to disqus.php file. File is under /plugins/disqus-core folder.

disqus.php

How to fix this Disqus error?

Fix is very simple. We just have to add below statement to disqus.php file. File is under /plugins/disqus-core folder.

/plugins/disqus - core
load more v
22%

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL),Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. ,Understand that English isn't everyone's first language so be lenient of bad spelling and grammar., featuresstuff Competitions Conferences News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase CodeProject Stuff

Hi All,

Am unable to resolving this issue please provide me any solution to fix this.

am getting an below error

Refused to execute script from‘ https: //s2020293361.t.eloqu’ because its MIME type (‘text/html’) is 

   Thanks

Bharath
load more v
60%

Find more questions by tags jQuery,1How to make anchors in the slider on Bitrix?,1How to set background in the form of the ellipse?


const srcURL = 'https://xxx.xx/api/rur';
$.ajax({

         url: srcURL,
         async: false,
         jsonp: "callback",
         dataType: "jsonp",
         success: function(response) {
               and so on
48%

Hello, I'm having a problem with deploying on aws elasticbeanstalk. On localhost it runs normally but when deploy to eb I got this error.,I'm sorry for didn't reply to this. I have never found the solution yet. Fortunately, it is only a small project that serves only a static website, so I decided to move the whole project to pure React. Feel free to share any other solutions.,Re-run the webpacker install command:,(Still looking into this, as this did not seem to work for me)

-Rails 5.2 .1
   -
   gem 'webpacker', '~> 3.5' -
   yarn 1.9 .4
load more v

Other "chrome-execute" queries related to "Chrome refuses to execute an AJAX script due to wrong MIME type"