现在的位置: 首页 > 综合 > 正文

jQuery在IE浏览器中独有的跨域方式

2013年02月17日 ⁄ 综合 ⁄ 共 615字 ⁄ 字号 评论关闭

说明:只有IE支持此种跨域,jQuery版本应不高于1.4.4,目前只在IE9浏览器下测试,其他IE浏览器未测试。

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
</body>
<script>
$(
function(){
$(
"body").html('正在加载...');
$(
"body").load('http://www.baidu.com body',function(responseText,textStatus,XHR){
if('success'==textStatus)
{
if(''!=responseText)
{
$(
"body").html(responseText);
}
else
{
$(
"body").html('返回值为空,只有IE支持此种跨域,jQuery版本应不高于1.4.4');
}
}
else if('error'==textStatus)
{
$(
'body').html('错误,应该是跨域引起的错误');
}
else
{
$(
'body').html(textStatus+'错误');
}
});
});
</script>
</html>

抱歉!评论已关闭.