ITeye博客

IE9下使用jsonp方式调用问题

deng131 · 2012-01-31 19:03 · javascript · Web前端 · Markdown

  1. 如果JSONP返回的Content-Type不符合规范,那么请求将出现了被IE9 block掉的情况;
  2. 在IE9中,如果在Jsonp请求中,http response header中有X-Content-Type-Options: nosniff并且Content-Type: text/html; charset=GBK那么这个请求的内容不会被IE9当成 javascript执行。

IE9可执行脚本mime-type: "text/javascript", "application/javascript", "text/ecmascript", "application/ecmascript", "text/x-javascript", "application/x-javascript", "text/jscript", "text/vbscript", "text/vbs"

text/javascript与application/javascript的区别: application/javascript: JavaScript; Defined in RFC 4329 but not accepted in IE 8 or earlier, however text/javascript is accepted. text/javascript (Obsolete): JavaScript; Defined in and obsoleted by RFC 4329 in order to discourage its usage in favor of application/javascript. However,text/javascript is allowed in HTML 4 and 5 and, unlike application/javascript, has cross-browser support

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。