0
votes

I have a PCL project and recently updated the Xamarin forms to version 2.3.4.270 but it seems that after updating to this version the webview.navigated() event does not fire.

var browser = new BaseUrlWebView (); 
var htmlSource = new HtmlWebViewSource ();

    htmlSource.Html = @"<html>
        <head>
        <link rel=""stylesheet"" href=""default.css"">
        </head>
        <body>
        <h1>Xamarin.Forms</h1>
        <p>The CSS and image are loaded from local files!</p>
        <img src='XamarinLogo.png'/>
        <p><a href=""local.html"">next page</a></p>
        </body>
        </html>";

    htmlSource.BaseUrl = DependencyService.Get<IBaseUrl> ().Get ();

    browser.Navigated += (sender, e) => {
        this.DisplayAlert("Navigated", "Navigated the page", "Cancel");
    };

    browser.Source = htmlSource;


    Content = browser;
1

1 Answers

0
votes
var browser = new BaseUrlWebView ();
var htmlSource = new HtmlWebViewSource ();

htmlSource.Html = @"Some HTML";
htmlSource.BaseUrl = DependencyService.Get<IBaseUrl> ().Get ();
browser.Source = htmlSource;
browser.Navigated += WebViewOnNavigated;
Content = browser;

private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e){

     await DisplayAlert("Navigated", "Navigated the page", "Cancel");
}