Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Joao_V_
Beginner
652 Views

xhttp.status returning 0 on Android

Jump to solution

My Application need to connect to an server, it works on IOS, but on Android not.

On IOS they return code 200, 404 etc

On Android they only return 0, for error, succes, anything!

 

My code:

     var xhttp = new XMLHttpRequest();
              xhttp.open("GET", HTTP, true);
        xhttp.onreadystatechange = function() {
            alert(xhttp.status);
    if ((xhttp.readyState == 4 && xhttp.status == 200) || (xhttp.readyState == 4 && xhttp.status == 0)) {
      document.getElementById("SIFrame").value = xhttp.responseText;
        TA = TXTIFrame.value;
        lines=TA.split("\n");
        document.getElementById("LineE").innerHTML = lines[LE];
        A1B.innerHTML = lines[R1];
        A2B.innerHTML = lines[R2];
        A3B.innerHTML = lines[R3];
        A4B.innerHTML = lines[R4];
        A5B.innerHTML = lines[R5];
         activate_page("#readerpage");
    
                
    } else {
        if(MSG == false && xhttp.status == 404) {
                    alert("Esse arquivo não pode ser encontrado, verifique sua conexão com a internet!")
                    MSG = true;
        }
    }

Thanks for the help!

Tags (2)
0 Kudos
1 Solution
Hamilton_Tenório_da_
Valued Contributor I
652 Views

@Joao> maybe this post helps you: https://software.intel.com/en-us/comment/1867247#comment-1867247, thread Paul F. (Intel)  Wed, 04/06/2016 - 08:57

View solution in original post

2 Replies
Hamilton_Tenório_da_
Valued Contributor I
653 Views

@Joao> maybe this post helps you: https://software.intel.com/en-us/comment/1867247#comment-1867247, thread Paul F. (Intel)  Wed, 04/06/2016 - 08:57

View solution in original post

Elroy_A_Intel
Employee
652 Views

I recommend that you add add an * (asterisk) to the network request field and http://* in the intent field on the projects panel. These configuration settings are visible for Cordova projects under the Build settings sections for the desired mobile platform. After you have successfully tested your project, the appropriate domain name (http://my-server.com) to the intent field. If your have more domain names, add them to the field separated by commas. 

Reply