Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView Navigated and Navigating events do not occur #5280

Closed
LanceMcCarthy opened this issue Mar 14, 2022 · 3 comments
Closed

WebView Navigated and Navigating events do not occur #5280

LanceMcCarthy opened this issue Mar 14, 2022 · 3 comments
Assignees
Labels
area-controls-webview WebView platform/android 🤖 platform/windows 🪟 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@LanceMcCarthy
Copy link

Description

WebView's Navigated and Navigating events are not executing when website navigation occurs. This is easy to reproduce, see steps below for specific guidance.

Note: This has been previously reported, but was closed without a defined solution #3857

Steps to Reproduce

  1. Create a new .NET MAUI preview13 project, add a ContentPage and use a WebView as the only page element
  2. Subscribe to the Navigating and Navigated events, use any website for the Source
  3. Use breakpoints or Debug.WriteLine in both event handlers to observe if the event handler is being executed
  4. Start debugging the project (any platform, I repro on Android and WinUI)

Observe => The Navigating and Navigated event handlers are never executed.

Also important, although my steps show to use Android, this issue seems exists on every platform.

Here is code you can use:

<ContentPage ...>
    <WebView x:Name="WebView1"
                      Source="https://www.bing.com"
                      Navigating="WebView1_Navigating"
                      Navigated="WebView1_Navigated"/>
</ContentPage>
private async void WebView1_Navigating(object sender, WebNavigatingEventArgs e)
{
    Debug.WriteLine("Navigating Fired");
}

public async void WebView1_Navigated(object sender, WebNavigatedEventArgs e)
{
    Debug.WriteLine("Navigated Fired");
}

Version with bug

Preview 13 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows, I was not able test on other platforms

Affected platform versions

Android 12 / API 31

Did you find any workaround?

I need anything that can give me the navigated to URL. Specifically, I need the query string, but nothing I tried works.

Relevant log output

I don't see any relevant output.
@LanceMcCarthy LanceMcCarthy added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Mar 14, 2022
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Mar 14, 2022
@jsuarezruiz jsuarezruiz self-assigned this Mar 14, 2022
@jfversluis jfversluis removed the s/needs-verification Indicates that this issue needs initial verification before further triage will happen label Mar 14, 2022
@wenwen60 wenwen60 added the s/triaged Issue has been reviewed label Mar 15, 2022
@wenwen60
Copy link

Reproduce on widows with VS2022 17.2.0 Preview 2.0 [32215.517.main], attach repro sample
MauiApp4.zip.

@wenwen60 wenwen60 added s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/triaged Issue has been reviewed labels Mar 15, 2022
@LanceMcCarthy
Copy link
Author

LanceMcCarthy commented Mar 17, 2022

Hi team,

I wanted to provide a status update after bumping my project to use to preview14.

Android ✔

I am now seeing the Navigated event successfully fire and am getting the expected Url values!

image

Windows ✔

Windows (WinUI3) is working as well!

image

iOS/MacCatalyst ❓

WIP - will report back with results when VS 2022 Preview -> Mac deployments are working.

[edit] Updated test results after fixing problem with Windows deploy

@Redth
Copy link
Member

Redth commented Mar 21, 2022

Thanks for the follow up! Closing for now, please file a new issue if you find otherwise, but from my testing awhile back this should work in iOS/Catalyst now as well.

@Redth Redth closed this as completed Mar 21, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 20, 2022
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-webview WebView platform/android 🤖 platform/windows 🪟 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants