MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
444 stars 53 forks source link

CoreWebView2NavigationKind additional types #3682

Open JasonHeGit opened 1 year ago

JasonHeGit commented 1 year ago

Is your feature request related to a problem? Please describe. In our CEF build, when navigation is requested, if the cef_transition_type_t is TT_LINK, we cancel navigation and may open the link in the user's default browser instead. I am trying to copy the same functionality in our WebView2 build in our NavigationStarting event handler. However, I am unable to discern whether the navigation is due to a link click, form submission, script, API call, etc. We really only want to perform this logic on link clicks only. The recently added CoreWebView2NavigationKind appears to be the CEF equivalent, but is missing types we need, specifically the TT_LINK type.

Describe the solution you'd like and alternatives you've considered Please add additional types from CEF like TT_LINK to the CoreWebView2NavigationKind enum.

Thanks!

AB#45823429

novac42 commented 1 year ago

Thanks for reaching out. If possible could you please shed some light on what kind of app you are building and example scenario where you need to cancel navigation and open link in default browser?

JasonHeGit commented 1 year ago

Thanks for reaching out. If possible could you please shed some light on what kind of app you are building and example scenario where you need to cancel navigation and open link in default browser?

Our app uses WebView2 controls for multiple different purposes To

  1. View PDF files
  2. View local html files
  3. View an online payment processing page and so on...

Any of the above may contain links. We sometimes want to open these links in a new window or in the user's default browser. For example, when viewing a PDF, we don't want the user to navigate away from the PDF via a link. Or when navigating to a third party website that requires a login, it may be preferred for the login to be done in the user's browser.