WebView does not work properly on Mac

Hello Friends

I have a strange issue with WebView on Mac OS.
I created a simple project with only one page with WebView control on it (and some labels and buttons).
the WebView works as expected on iOS and Android (everything is like in any browser) but on Mac it shows a web pages but the links on those pages are not clickable and changing the WebViews's Source property does absolutely nothing. Also when the WebView loads a page the Navigating event is fired (as expected) but the Navigated event is not. Also the WebView does not want to load https Google com (can't post the link) but it loads some other web sites successfully.

Pls suggest me what can be wrong? Or how to diagnose the problem?

Sources:

MainPage.xaml

<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="..." xmlns:x="..." xmlns:local="clr-namespace:FaaPromo" x:Class="FaaPromo.MainPage">
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="auto" />
      <RowDefinition Height="*" />
      <RowDefinition Height="auto" />
    </Grid.RowDefinitions>
    <StackLayout Orientation="Horizontal" Grid.Row="0">
      <Entry x:Name="Url" Placeholder="URL" HorizontalOptions="FillAndExpand" />
      <Button x:Name="Go" Text="Go"></Button>
    </StackLayout>
    <WebView x:Name="Browser" Grid.Row="1" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" WidthRequest="1000" HeightRequest="1000">
    </WebView>
    <StackLayout Orientation="Horizontal" Grid.Row="2">
      <Label x:Name="Status" Text="Awaiting..." />
    </StackLayout>
  </Grid>
</ContentPage>

MainPage.xaml.cs

    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
            Browser.Navigating += Browser_Navigating;
            Browser.Navigated += Browser_Navigated;
            Browser.Source = "... url here ...";

            Go.Clicked += Go_Clicked;
        }

        void Go_Clicked(object sender, System.EventArgs e)
        {
            Browser.Source = Url.Text;
        }

        void Browser_Navigating(object sender, WebNavigatingEventArgs e)
        {
            Status.Text = "Loading...";
        }

        void Browser_Navigated(object sender, WebNavigatedEventArgs e)
        {
            Status.Text = "Loaded.";
        }
    }

Assemblies

Xamarin.Forms version 3.3.0.967583 (from nuget)
Xamarin.Mac version 5.0.0.0

Answers

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    This sounds like a Xamarin.Forms issue, I am unsure what native control they expose as a WebView.

    Consider filing a bug here.

    I will move this to the correct forum section.

  • MProtocolMProtocol Member ✭✭

    I have also this issue, any solution?

  • I am also experiencing these problems. One thing I had to do was add the exception for ATS, without that no http pages will load. Without it one loads, but cant seem to navigate further.

    How to make AS changes to info.plist - //docs.microsoft.com/en-us/xamarin/ios/app-fundamentals/ats

Sign In or Register to comment.