dotnet / dotnet/maui

Get error details for WebView failed navigation

Open
#7,159 1 comment 0 reactions 0 assignees View on GitHub
area-controls-webview proposal/open t/enhancement ☀️
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

In Xamarin Forms I was getting failed navigations on my WebView but I did not have a way to know the cause of them. The information can be obtained doing a custom renderer of WKNavigationDelegate (for iOS) with a significant code following the standard CustomWebViewNavigationDelegate, as the latter cannot be inherited, but that would be risky, complicated and would loose the official upgrades from Xamarin.

### Public API Changes

I think getting information of a failed navigation is important enough to include it as a standard but I know the error information might defer from one platform to another. If that breaks some MAUI principles I would then request that "CustomWebViewNavigationDelegate" can be used as a base class for a renderer, being able to extend the DidFailProvisionalNavigation method and still do "base.DidFailProvisionalNavigation(...)" to execute the standard implementation.

### Intended Use-Case

My app has a WebView that sometimes fails on different URLs and it would be very useful to understand the cause of the failure to inform the user with more meaningful information, not just to say "the navigation has failed", and also for the app to take some actions depending of the error and to record statistics.

Contributor guide

Open the contributing guide

Research direction

Start at the WebView renderer and its CustomWebViewNavigationDelegate implementation, then inspect the WKNavigationDelegate DidFailProvisionalNavigation path described in the issue. Resolve whether the API should expose platform-specific failure details or allow safe base-class extension, and verify that failed navigations provide actionable information for apps.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.