Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make an XMLHttpRequest to another domain?

Tags:

Is there a way to use XMLHttpRequest in combination with other domains?

I would like to parse some xml from Google without having to use a server so it is minimalistically complex to run.

var req = getXmlHttpRequestObject();
...
req.open('GET', 'http://www.google.de/ig/api?weather=Braunschweig', true);
        req.setRequestHeader("Content-Type","text/xml");
        req.onreadystatechange = setMessage;
        req.send(null);

Doing it on the server side is no option at least then I wouldn't have to ask

like image 324
Thomaschaaf Avatar asked Nov 27 '08 21:11

Thomaschaaf


1 Answers

Nope, not right now. I believe I read that plans/design's are in the works by standards groups for the future, so we can securely do this.

Cross site scripting vulnerabilities would be rampant other wise.

JSONP is a possible solution if the other sites API supports.

like image 154
Brian Gianforcaro Avatar answered Sep 24 '22 09:09

Brian Gianforcaro