s***@163.com
s***@163.com
  • 发布:2017-01-14 09:15
  • 更新:2017-01-14 13:39
  • 阅读:3011

【报Bug】XMLHttpRequest在IOS中不可用

分类:HTML5+

详细问题描述
XMLHttpRequest在在安卓OK,到IOS就是不能请求,然后试验了官方DEMO在IOS也不行,显示XHR请求未完成!!

重现步骤
[步骤]
[结果]
[期望]

运行环境
[系统版本]IOS10
[浏览器版本]
[IDE版本]最新版本
[mui版本]

附件
[代码片段]
var url="http://www.dcloud.io/";
var xhr=null;

function xhrCreate() {
if ( xhr ) {
outLine( "xhr请求已创建" );
return;
}
outSet( "创建请求:" );
xhr = new plus.net.XMLHttpRequest();
xhr.onreadystatechange = function () {
switch ( xhr.readyState ) {
case 0:
outLine( "xhr请求已初始化" );
break;
case 1:
outLine( "xhr请求已打开" );
break;
case 2:
outLine( "xhr请求已发送" );
break;
case 3:
outLine( "xhr请求已响应");
break;
case 4:
outLine( "xhr请求已完成");
if ( xhr.status == 200 ) {
outLine( "xhr请求成功:"+xhr.responseText );
} else {
outLine( "xhr请求失败:"+xhr.status );
}
break;
default :
break;
}
}
xhr.open( "GET", url );
xhr.send();
}
function xhrResponseHeader() {
if ( xhr ) {
if ( xhr.readyState != 4 ) {
outLine( "xhr请求未完成" );
} else if ( xhr.status != 200 ) {
outSet( "xhr请求失败:"+xhr.readyState );
} else {
outSet( "xhr请求响应头数据:" );
outLine( xhr.getAllResponseHeaders() );
}
} else {
outSet( "未发送请求" );
}
}
function xhrAbort() {
if ( xhr ) {
outSet( "取消请求" );
if ( xhr.readyState != 4 ) {
xhr.abort();
}
xhr = null;
} else {
outSet( "未发送请求" );
}
}
[安装包]

联系方式
[QQ]410682035
[电话]13077688070

2017-01-14 09:15 负责人:无 分享
已邀请:
Trust

Trust - 少说废话

该问题目前已经被锁定, 无法添加新回复