jquery - 为什么 $.support.cors 在 IE 11 中为 false?

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

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

IE 11 should support cors.

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

最佳答案

$.support.cors确实返回true在 IE 11 中,如以下 fiddle 所示:

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>

但与 <meta http-equiv="X-UA-Compatible" content="IE=9">将输出“假”

<!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>

关于jquery - 为什么 $.support.cors 在 IE 11 中为 false?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23501209/

相关文章:

internet-explorer - IE9阻止跨源Web字体下载

javascript - 在 IE8 下,Page_Init 不会被调用

internet-explorer - Internet Explorer 8中的Raphael JS性能

php - EJS 有多大用处?

jquery - 我怎样才能覆盖CSS属性

javascript - 在html页面中从sqlite收取数据(addon firefox)

java - CORS 隐藏 header ?

javascript - 在正文而不是 header 中链接 javascript 文件会导致问题吗?

javascript - 使用子域时防止预检选项

apache - 在 Mac OS X 的 apache 中为 CORS 启用 mod_headers