且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

拒绝执行'https://s2020293361.t.eloqu'中的脚本,因为其MIME类型('text / HTML')不可执行

更新时间:2021-11-08 22:10:46

.ajax({
url:'https://example.com',
type:'post',
dataType:jsonp,
contentType :application / javascript,
成功:函数(msg){
console.log(成功);
},
错误:函数(请求,状态,错误){
console.log(错误);
}
});

i尝试使用diff contentTypes,例如text / html,text / javascript,application / jsonp

并从webconfig下面删除

< pre><删除名称=X-Content-Type-Options/>
< add name =X-Content-Type-Optionsvalue =nosniff/>
.ajax({ url: 'https://example.com', type: 'post', dataType: "jsonp", contentType: "application/javascript", success: function (msg) { console.log("success"); }, error: function (request, status, error) { console.log(error); } }); i tried with diff contentTypes like "text/html","text/javascript","application/jsonp" and removed from webconfig below line <pre><remove name="X-Content-Type-Options" /> <add name="X-Content-Type-Options" value="nosniff" />





已添加iis X-Content-Type-Options中的http响应标题



仍然得到相同的错误请建议我解决这个问题







谢谢



Bharath



added http response headers in iis X-Content-Type-Options

still getting same error please suggest me to fix this



Thanks

Bharath


您尝试加载的脚本的MIME类型为 text / html 。出于安全原因,大多数浏览器都不会执行该脚本,因为服务器指示它是不是脚本。



首先打开您尝试执行的脚本的URL,并确保内容实际上是Javascript。



如果是,那么您需要联系所有者您试图加载它的网站,让它们更正标题。
The script you're trying to load is being served with a MIME type of text/html. For security reasons, most browsers won't execute that script, because the server is indicating that it's not script.

Start by opening the URL of the script you're trying to execute, and make sure that the content is actually Javascript.

If it is, then you need to contact the owner of the site you're trying to load it from, to get them to correct the headers.