【问题标题】:Why is $.support.cors false in IE 11?为什么 $.support.cors 在 IE 11 中为假?
【发布时间】:2014-06-23 10:49:34
【问题描述】:

为什么$.support.cors false 在 IE 11 中?我正在使用 jquery 1.9.1 ($.fn.jquery == '1.9.1')。

IE 11 should support cors.

$.support.cors 在具有相同 jquery 版本的 Chrome 中为 true。

【问题讨论】:

  • 确保您没有因为缺少 doctype 标头而处于兼容性视图或 Quirks 模式。

标签: jquery internet-explorer cors internet-explorer-11 jquery-1.9


【解决方案1】:

$.support.cors 确实在 IE 11 中返回 true,如下小提琴所示:

http://jsfiddle.net/dM8pk/

X-UA-Compatible 设置为 IE=9 禁用 cors 支持。

下面会在IE 11中输出“true”

<!DOCTYPE html>
<html>
<body>
</body>
<script src="https://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
    $('<h1>').text($.support.cors).appendTo($('body'));
});
</script>
</html>

但是用&lt;meta http-equiv="X-UA-Compatible" content="IE=9"&gt;会输出“false”

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=9"></meta>
    </head>
<body>
</body>
<script src="https://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
    $('<h1>').text($.support.cors).appendTo($('body'));
});
</script>
</html>

【讨论】:

  • 哇...+1,000,000,000!
猜你喜欢
  • 2016-08-13
  • 2016-06-29
  • 2012-11-22
  • 2014-03-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-23
相关资源
最近更新 更多