Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

HttpRequest Works on iPad, Fails on MobileWeb

$
0
0

I've boiled an httpRequest down to the easiest testable model. Testing this on iPad returns the correct info from the server. Testing this on MobileWeb does not return anything except an error ('Can't Reach Host'). The server it is accessing is setup with CORS which I have confirmed on this site: http://client.cors-api.appspot.com/client

Titanium.UI.setBackgroundColor('#000');
 
var win1 = Titanium.UI.createWindow({  
    backgroundColor:'#fff'
});
 
win1.open();
 
var button = Ti.UI.createButton({width:200,height:50,title:'TEST'});
win1.add(button);
 
button.addEventListener('click',function(){
    var xhr = Titanium.Network.createHTTPClient();
    xhr.open('GET', 'http://remysharp.com/demo/cors.php');
    xhr.onerror = function(e){ 
        alert('Error ='+e.error);
    };
    xhr.onload = function(){
        alert('Response ='+this.responseText);
    };
    xhr.send(); 
});
Why would this work for iPad but not for mobileWeb. There are no bugs logged with this in Jira.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>