Skip to content

Maui webview .Navigated event is not triggered #23502

@softourS

Description

@softourS

Description

I think the title explains it all. When using a WebView on Maui and adding the Navigated event, this event is not triggered when is reached. Specifically, it occurs when using WebViewHandlers, or at least it used to work when we used a simple WebView, and after we learned about Handlers instead of Renderers and changed the code accordingly, it stopped working.

We used this sample for an example of Custom WebViewHandler (both iOS and Android):
https://github.com/nmoschkin/MAUIWebViewExample.git

It's on the latest version, .net MAUI 8.0 (VS for Mac doesn't tell us more, thank you VS).

Steps to Reproduce

The sample code should suffice but just in case:

1.- Create MAUI app (VS for Mac)
2.- Create both a HybridWebView (inherits from WebView, the example of handlers had View, but that way the WebView did not recognize the .Navigated event as belonging to WebView) and 2 WebViewHandlers (Android & iOS).
3.- On the MainPage, create a variable for the HybridWebView:
private static HybridWebView browser = new();
4.- Add a source (browser = new HybridWebView { Source = url };) on the public MainPage
5.- Add the .Navigated event, like this:
browser.Navigated += async (sender, e) => {
//Write something here
};
6.- Set a breakpoint inside the event
7.- Nothing happens

Link to public reproduction project repository

https://github.com/softourS/regulares-netmaui-app-public.git

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

Android min version 21 to target 34; iOS min version 14 to target 17.2

Did you find any workaround?

Everywhere we search they'd say it's solved, but the issue is usually forgotten or ignored, so no.

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions