gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 06:47:01 24 4
gpt4 key购买 nike

为什么 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com