Xamarin forms webview _blank links not responding.

JDBenitez 1 Reputation point
2021-04-29T09:40:16.66+00:00

I am using a xaml form with webview. In android the links that have target="_blank" associated with them no longer fire the navigation events. I've read that it's because of changes in the web implementation. I have found solutions for xamarin android apps but not for xamarin forms apps.
how can i enable _blank links to reach webview events in xamarin forms? i am using this events:

webView.Navigated += OnNavigatedHandler;
webView.Navigating += OnNavigatingHandler;

Translated with www.DeepL.com/Translator (free version)

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,353 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,961 Reputation points
    2021-04-29T11:29:47.657+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    I have found solutions for xamarin android apps but not for xamarin forms apps.

    If you've found the solution of the Android project, try to create a custom WebView renderer to configure the settings of the solution in the native project. Yould could check the following docs to get how to create a webView renderer?

    https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/hybridwebview
    https://learn.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/customrenderers-hybridwebview/

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.