0

This is happening on Safari iOS 10 Cordova:6.3.1

Request using Angular $http, error function not called

$http.get("http://10.255.255.1").then(function(res){
   console.log("res: " + res);
},function(err){
   console.log("err: " + err);
});

Promise {$$state: {status: 0}, then: function, catch: function, finally: function}

console: Failed to load resource: The request timed out. (10.255.255.1, line 0)


Request using XMLHttpRequest catches timeout error

var xhr = new XMLHttpRequest(); xhr.onload = function () { 
    console.log("request finished") 
}; 
xhr.ontimeout = function (e) { 
    console.log("request timeout") 
}; 
xhr.open('GET', 'http://10.255.255.1', true);
xhr.send(null); 

console: request timeout

FYI: http://10.255.255.1 is a url that I am using to test timeout. Source: Artificially create a connection timeout error

1
  • For reference: This has been fixed in Angular and the fix is/will be included in versions 1.5.9 and 1.6.0-rc.0. See also github.com/angular/angular.js/issues/15380. Commented Nov 14, 2016 at 9:01

1 Answer 1

0

XMLHttpRequest throws an error after 60 seconds even if you increase the timeout.

So it's a iOS 10 WebView thing which is not configurable I believe.

In Angular, If you supply a timeout property less than 60 seconds, an error is properly throw.

Still seems like a bug in Angular. It should still throw and error after request timeout by the WebView.

Sign up to request clarification or add additional context in comments.

1 Comment

openradar.appspot.com/28810194 is the radr issue about it and bugs.webkit.org/show_bug.cgi?id=163814 the fix in webkit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.