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

CoreWebView2NavigationStartingEventArgs.Cancel not working #560

Closed
ukandrewc opened this issue Oct 21, 2020 · 14 comments
Closed

CoreWebView2NavigationStartingEventArgs.Cancel not working #560

ukandrewc opened this issue Oct 21, 2020 · 14 comments
Labels
bug Something isn't working

Comments

@ukandrewc
Copy link

ukandrewc commented Oct 21, 2020

Description
Navigation not cancelled (I'm fairly sure it did on previous releases)
Version
SDK: 1.0.674-prerelease
Runtime: 88.0.673.0 (Official build) dev (32-bit)
Framework: WinForms
OS: Win7 32 bit SP1

Repro Steps

Private Sub WVBrowser_NavigationStarting(sender As Object, e As CoreWebView2NavigationStartingEventArgs) Handles 
  Me.NavigationStarting
  e.Cancel = True ' Doesn't cancel

AB#29899723

@ukandrewc ukandrewc added the bug Something isn't working label Oct 21, 2020
@champnic
Copy link
Member

Yes this is a known issue with 1.0.674-prerelease that we have a fix for. It will be available in the next SDK. Thanks!

@pagoe-msft
Copy link

Hi Everyone,

This was addressed in the 1.0.664.37 version.

@dmcgloin
Copy link

dmcgloin commented Nov 24, 2020

@champnic @pagoe-msft I'm trying 1.0.707-prerelease, and this issue does not appear fixed for me. Triple-checking my code but when I try to cancel at the NavigationStarted event, the browser strill proceeds to the bogus redirect URL instead of stopping the load.

Side note: 1 out of 5 times, my first page does not render correctly. It's just a grey page. When I resize the parent window (and thus the WPF browser control) it redraws correctly. This is new behavior when compared to previous release. I'll open a separate issue

@ukandrewc
Copy link
Author

e.Cancel works for me on 1.0.707.0 Winforms.

@champnic
Copy link
Member

champnic commented Dec 1, 2020

@dmcgloin Could you see if cancelling a navigation works with something simple? I think we have a bug or two where cancellation in particular fails in certain scenarios, like malformed URLs, etc.

@fsuk
Copy link

fsuk commented Dec 2, 2020

Does not work for me in WPF even with the simplest example.

@champnic
Copy link
Member

@fsuk Could you add some details about your simple example - SDK/runtime versions, code, etc?

I just tried in a WPF app with 1.0.721-prerelease SDK, and when I do e.Cancel = true; during the NavigationStarting event, it cancels the navigation.

@Nevcairiel
Copy link

Nevcairiel commented Apr 19, 2021

I'm also experiencing issues with Cancel on 1.0.774.44 or 1.0.824-prerelease

The website is using a JS .click() on a "a href" element, and i'm trying to suppress that navigation event. The target URL requires authentication, so WebView2 pops up the credentials box, and the request is not silently canceled.

I'm using the C++ Win32 interface.

It seems like the cancel is working sometimes, as if there is a timing component due to the authentication.

@champnic
Copy link
Member

@Nevcairiel This sounds like a separate issue. Can you please open it in a new issue to track? Thanks!

@kha1ne
Copy link

kha1ne commented Oct 13, 2021

Hello @champnic

Issue we are experiencing is on redirect request, we are getting only one occurrence of ICoreWebView2NavigationCompletedEvent in which source URI contains the redirect URI.

So, can this be connected with the above, and if so, is this solved already in newer runtime versions?

While we are at it, is there any way that we can download older fixed version of runtime 92.xx?

@champnic
Copy link
Member

@kha1ne Hey Marko - that also sounds like a separate thing. Could you open a new issue with relevant details, such as your current runtime and SDK version?

No - we only provide the latest and previous fixed version runtime.

@anovik
Copy link

anovik commented Jan 10, 2022

@champnic It seems there is still a problem with Cancel CoreWebView2NavigationStartingEventArgs for WinUI3 in Microsoft.WindowsAppSdk 1.0.0, could you please check?

@champnic
Copy link
Member

@anovik Hey Anna - would you mind opening that as a new issue with more details on what the issue is and how to reproduce it? Thanks!

@anovik
Copy link

anovik commented Jan 11, 2022

@champnic I've opened #2072

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants