Fixed a bug that xhr cross-domain error

This commit is contained in:
VisualSJ 2015-06-18 09:23:15 +08:00
parent 010cb23ead
commit 400b2d7663
1 changed files with 1 additions and 1 deletions

View File

@ -107,10 +107,10 @@ var XHRTestLayer = cc.Layer.extend({
//set arguments with <URL>?xxx=xxx&yyy=yyy //set arguments with <URL>?xxx=xxx&yyy=yyy
if(cc.sys.isNative){ if(cc.sys.isNative){
xhr.open("GET", "http://geek.csdn.net/news/detail/33683", true); xhr.open("GET", "http://geek.csdn.net/news/detail/33683", true);
xhr.setRequestHeader("Accept-Encoding","gzip,deflate");
}else{ }else{
xhr.open("GET", "http://httpbin.org/get?show_env=1", true); xhr.open("GET", "http://httpbin.org/get?show_env=1", true);
} }
xhr.setRequestHeader("Accept-Encoding","gzip,deflate");
xhr.send(); xhr.send();
}, },