WKWebView does not finish/timeout when there is no internet access WKWebView does not finish/timeout when there is no internet access javascript javascript

WKWebView does not finish/timeout when there is no internet access


Try:

WKNavigationDelegate

- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error

You can check the error, usually you will have an error.code -1009:

Check this list: Error Codes


I think you will have to do this in your HTML page. You can include a small JavaScript there that runs a timer and checks if your remote script has loaded or not.

If it has not loaded then the JavaScript can show an error in the page directly or notify your application through a script message handler.

(I don't think HTML has an API that a page can use to find out about content loading errors. There are some hints about that on Verify External Script Is Loaded)