You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
/**
* 5+ ajax
*/
( function ( $ ) {
var originAnchor = document . createElement ( 'a' ) ;
originAnchor . href = window . location . href ;
$ . plusReady ( function ( ) {
$ . ajaxSettings = $ . extend ( $ . ajaxSettings , {
xhr : function ( settings ) {
if ( settings . crossDomain ) { //强制使用plus跨域
return new plus . net . XMLHttpRequest ( ) ;
}
//仅在webview的url为远程文件, 且ajax请求的资源不同源下使用plus.net.XMLHttpRequest
if ( originAnchor . protocol !== 'file:' ) {
var urlAnchor = document . createElement ( 'a' ) ;
urlAnchor . href = settings . url ;
urlAnchor . href = urlAnchor . href ;
settings . crossDomain = ( originAnchor . protocol + '//' + originAnchor . host ) !== ( urlAnchor . protocol + '//' + urlAnchor . host ) ;
if ( settings . crossDomain ) {
return new plus . net . XMLHttpRequest ( ) ;
}
}
if ( $ . os . ios && window . webkit && window . webkit . messageHandlers ) { //wkwebview下同样使用5+ xhr
return new plus . net . XMLHttpRequest ( ) ;
}
return new window . XMLHttpRequest ( ) ;
}
} ) ;
} ) ;
} ) ( mui ) ;