Rafthecalf
Rafthecalf

Reputation: 461

Failed to load resource: The network connection was lost Safari

Making XMLHttpRequests in iOS WKWebView when idle (in background) and locking screen causes the request to error out and we get this in the safari console log:

Failed to load resource: The network connection was lost

Does anyone know why Safari closes the connection? Or is it the server closing the connection?

Any help would be greatly appreciated.

Upvotes: 4

Views: 4123

Answers (2)

Rafthecalf
Rafthecalf

Reputation: 461

Contacted Apple support, this is actually done by design. WKWebView has been "optimized" to not make network connections while screen is locked.

Upvotes: 2

slotdp02
slotdp02

Reputation: 438

Are you by chance using Angular and also getting this error:

0 -  {"isTrusted":true}

I have been getting the error you are getting along with this one.

In any sense I found this answer helpful because it's probably a CORS issue:

{"isTrusted":true} exception in core.umd.js

Hope that at least points you in the right direction.

Upvotes: 0

Related Questions