Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

WebView updating HTML not working for IOS and WinPhone

$
0
0

Hi all,

Since I've updated to XF 1.3 I'm facing more troubles with the WebView. There were already some bugs with the databinding, so I had a work-around for that, which is discussed here. But now I'm facing a problem where the webview is not updated at all for IOS and Windows Phone, but does for Android.

A simple reproduction for this problem:

WebViewPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="FormsWebViewTest.WebViewPage">
  <WebView x:Name="webview" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/>
</ContentPage>

WebViewPage.xaml.cs

public partial class WebViewPage : ContentPage
{
        public WebViewPage()
        {
                InitializeComponent ();
                // This works for all platforms, but only one time.
                webview.Source = new HtmlWebViewSource() { Html = "test" };
        }
}

WebViewPage.xaml.cs - OnAppearing

protected override void OnAppearing()
{
        base.OnAppearing();
        // Update webview after x seconds, works for Android, but nothing changes for IOS and WP.
        Task.Run(async () =>
        {
                await Task.Delay(3000);
                webview.Source = new HtmlWebViewSource() { Html = "updated" };
        });
}

Is this a (known) bug? Does anybody has a workaround, so that I can update the HTML in a webview?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>