Itunes is based on the Webkit platform, and we cannot use cross-site XmlHttpRequest in JavaScript due to security policies. But, as an exception, we can do this with a special heading. Here is the source code, and I did it successfully in Safari:
var url = 'http://mysite.net/canvas.php';
var mybody = "<?xml version='1.0' charset='utf-8'?><person><name>Arun</name></person>";
var http = new XMLHttpRequest();
http.open("POST", url, true);
http.setRequestHeader("X-PINGOTHER", "pingpong");
http.setRequestHeader('Content-Type', 'application/xml');
http.setRequestHeader("Content-length", mybody.length);
http.setRequestHeader("Connection", "close");
http.send(mybody);
I sent the xml data to my server and received a return response in the Safari browser, but I cannot do this in iTunes LP. So what are the problems?
source
share