Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 212
Rafthecalf Avatar asked Oct 15 '25 15:10

Rafthecalf


1 Answers

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

like image 173
Rafthecalf Avatar answered Oct 17 '25 08:10

Rafthecalf