IE9脚本响应由于mime类型不匹配而被阻止 [英] IE9 script response blocked due to mime type mismatch

查看:1010
本文介绍了IE9脚本响应由于mime类型不匹配而被阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码段将Google Fusion Table中的数据作为json加载.

I use the following code snippet to load data from google fusion table as json.

var fileref = document.createElement("script");
fileref.setAttribute("type", "text/javascript");
fileref.setAttribute("src", "http://tables.googlelabs.com/api/query?sql=select * from 588320&hdrs=false&jsonCallback=LoadTable");

在IE8,FF,Chrome中非常有效,但是现在IE9不知道如何处理回调,因为响应和mime类型不匹配. IE9在使用jsonCallback参数时会报告以下脚本错误,因为它不喜欢mime类型.

Works great in IE8, FF, Chrome, but now IE9 doesn't know how to handle the callback because the response and mime types don't match. IE9 reports the following script error when using jsonCallback param because it doesn't like the mime type.

SEC7112:来自 http://tables.googlelabs.com/api/query?sql=select 的脚本a> *由于MIME类型不匹配而阻止了588320& hdrs = false& jsonCallback = LoadTable.

SEC7112: Script from http://tables.googlelabs.com/api/query?sql=select * from 588320&hdrs=false&jsonCallback=LoadTable was blocked due to mime type mismatch.

是否有一种解决方法,我必须在本地托管src(或者我做错了什么)?

Is there a workaround short of me having to host the src locally (or am I doing something wrong)?

Response Headers

Content-Type text/plain; charset=UTF-8 
Content-Encoding gzip 
Transfer-Encoding chunked 
Date Fri, 13 May 2011 02:19:11 GMT 
Expires Fri, 13 May 2011 02:19:11 GMT 
Cache-Control private, max-age=0 
X-Content-Type-Options nosniff 
X-Frame-Options SAMEORIGIN 
X-XSS-Protection 1; mode=block 
Server GSE 


Request Headers

Host tables.googlelabs.com 
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Language en-us,en;q=0.5 
Accept-Encoding gzip, deflate 
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 
Keep-Alive 115 
Connection keep-alive 
Cache-Control max-age=0 

推荐答案

问题是Google正在发送X-Content-Type-Options: nosniff声明并返回没有JavaScript MIME类型的JavaScript文件.只能通过删除nosniff声明或通过修复MIME类型以指示该文件实际上是脚本的方式来解决此问题.

The problem is that Google is sending an X-Content-Type-Options: nosniff declaration and returning a JavaScript file without a JavaScript MIME type. This can only be fixed by either removing the nosniff declaration or by fixing the MIME type to indicate that the file is, in fact, script.

我已经向Google发送了有关此邮件.

I've sent mail to Google about this one.

这篇关于IE9脚本响应由于mime类型不匹配而被阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆