Bug 59003 - WebView opens links with target="_blank" in system browser
Summary: WebView opens links with target="_blank" in system browser
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-08-24 08:40 UTC by Ilia Dudarev
Modified: 2017-08-25 21:23 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Ilia Dudarev 2017-08-24 08:40:42 UTC
Windows 10 Creators Update, Visual Studio 2017 with Windows SDK, 
WebView.Navigating handler does not being invoked for links which is marked to open in new tab, not able to prevent opening system browser.
Tested same code on Adnroid and it works fine.
Comment 1 Jimmy [MSFT] 2017-08-25 16:23:59 UTC
This appears to be the default, native behavior in UWP as this also happened with a new non-Forms UWP app. 

However the UWP WebView provides the NewWindowRequested[1] event so you can override this behavior. You can use a custom UWP WebView renderer in order to access the event. Hope this helps! 

[1] https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.WebView#Windows_UI_Xaml_Controls_WebView_NewWindowRequested
Comment 2 Ilia Dudarev 2017-08-25 21:23:56 UTC
Yes, that would be handy, thanks!

I'm still getting used to this per-platform extensions. Anyway, kinda weird to catch logic events by the view renderer.

I see this is marked as resolved... Wouldn't it be fixed? I know I can bypass this via Renderer, but shouldn't Xamarin Forms have same behavior on each platform by default?