Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] WebView.Navigated event not fired when no internet available on iOS. #12312

@aaRopi

Description

@aaRopi

Description

WebView.Navigated NOT fired on iOS when no internet connection is available.

Steps to Reproduce

  1. Hook into WebView.Navigating and WebView.Navigated events.
  2. Run app on iOS without internet connection.
  3. Handler for WebView.Navigated is never called.

Expected Behavior

On iOS, when loading a url in the WebView, if there is no internet connection available, the WebView should fire a Navigated event with WebNavigationResult.Failure.

Since this is observed behavior on Android, I expected iOS to behave the same way.

Actual Behavior

The Navigated event is never fired for this error case.

Basic Information

  • Version with issue: 4.8.0.1364
  • Platform Target Frameworks:
    • iOS: 13, 14

Workaround

No suitable workaround found yet. I know where the bug is and how it can be fixed.

  1. iOS WkWebView requires a delegate WkNavigationDelegate to handle various callbacks from the WkWebView.

  2. The WkNavigationDelegate has 2 methods to handle errors:

  • DidFailNavigation(WKWebView webView, WKNavigation navigation, NSError error)
  • DidFailProvisionalNavigation(WKWebView webView, WKNavigation navigation, NSError error)
  1. Only one of them has been implemented as can be seen here: WkWebViewRenderer source code

  2. For now the solution would be to implement the other method. The implementation can be copied from DidFailNavigation

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions