variablo

Q: XMLHttpRequest cannot load

I would like to make a simple XMLHttpRequest. But something runs wrong.

In iAd Producer everything is fine and if i start the request at the iPad (widget-tester),

i get this message:

[Error] XMLHttpRequest cannot load http://www.example.com/Master.xml. Origin x-ibooks-th://ibookswidgettester is not allowed by Access-Control-Allow-Origin.

 

If I start a request to another server it works.

Is there a possibility to set the origin of the Widget to zero or something else???

 

This is my code:

    var url = "http://www.example.com//Master.xml";
        var xmlhttp;
        xmlhttp = new XMLHttpRequest();
        xmlhttp.onreadystatechange=function()
        {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
            {
            var xmlDoc = xmlhttp.responseXML;
            console.log("update done");
            }
        };
        xmlhttp.open("GET",url,true);
        xmlhttp.send();

 

This is the request and response header out of iAd Producer

GET /Master.xml HTTP/1.1

Host: www.example.com

Accept: */*

Accept-Encoding: gzip, deflate, sdch

Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4

Origin: null

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.94 Safari/537.36

 

HTTP/1.1 200 OK

Accept-Ranges: bytes

Content-Encoding: gzip

Content-Length: 53555

Content-Type: text/xml

Date: Fri, 30 Jan 2015 19:47:40 GMT

ETag: "13009d-1d4a41-504d55a1dc980"

Last-Modified: Tue, 07 Oct 2014 13:41:10 GMT

Server: Apache

Vary: Accept-Encoding,User-Agent

iPad 2, iOS 8.1.3

Posted on Jan 30, 2015 3:03 PM