I'm trying to compile a Titanium app for Web. When I try to contact the server via http request in the browser console I see a OPTIONS method instead of a GET method:
var request = Ti.Network.createHTTPClient();
request.open('GET', url);
request.onload = function() {
Ti.API.debug('CALLBACK OK');
};
request.onerror = function(e) {
Ti.API.debug('CALLBACK ERROR' + e.error);
};
request.send(args);
The request reach the server but e.error said "Can't reach host". I've tryed to do a OPTIONS request before this request fallowing: http://www.w3.org/TR/cors/ and setting in the first response:
Access-Control-Allow-Origin: myserverurl
Access-Control-Max-Age: 2520
Access-Control-Allow-Methods: PUT, DELETE, GET, POST, XMODIFY
But I get the same response and the code executed is the onerror function...
Pleas help me I'm wasting ours...
Ok, It's obviously a XSS problem a workaround is to disabled browser security. e.g. in Chromium: