NetworkError on XMLHttpRequest.send()

4845
1
05-03-2017 07:35 AM
JonathanBailey
Occasional Contributor III

Only when using the Edge browser, I'm getting a generic NetworkError (code 19) when calling XMLHttpRequest.send() against an ArcGIS Online REST endpoint. I have an array of feature service URLs, and I loop through the array to query each feature service for its layers. Following is a code snippet:

Array.forEach(featureServiceURLs, lang.hitch(this, function (featureServiceURL) {
    
    var url = featureServiceURL + "/layers?f=json&token=" + token;
    var xmlHTTPRequest = new XMLHttpRequest();
    xmlHTTPRequest.open("GET", url, false);
    xmlHTTPRequest.send();
    var response = JSON.parse(xmlHTTPRequest.responseText);

    // ... additional code to handle response

}));‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

If the array contains only one URL, then everything works fine. If it contains more than one URL, a NetworkError occurs after the first call to XMLHttpRequest.send().

This behaviour is not observed in Chrome or Firefox.

0 Kudos
1 Reply
ThomasSolow
Occasional Contributor III

I've never used synchronous http requests.  It seems possible to me that this is an issue with synchronous http request support in some browsers.  I'd try an async pattern to see if that changes anything.

If you're pulling in the Esri JS API you could also use esriRequest which provides a nice wrapper around xmlHttpRequest and returns a promise.

0 Kudos