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

webview open new blank page in browser

$
0
0
public MainPage()
    { 
    Title = "XXXXXX";

        var source = new UrlWebViewSource();
    source.Url = "http://XXXXXXXXX/student/studentlogin.aspx";
        var webView = new WebView
        {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.FillAndExpand,
            Source = source
        };
        webView.Navigating += (s, e) =>
        {
            if (e.Url.Contains("FeeReceipt.aspx"))
            {
                try
                {
                    var uri = new Uri(e.Url);
                    Device.OpenUri(uri);
                }
                catch (Exception)
                {
                }

                e.Cancel = true;
            }

    };
webView.Navigated += (object sender, WebNavigatedEventArgs e) => {
            System.Diagnostics.Debug.WriteLine("Done");
        };

Content = new ContentView {
            Content = new StackLayout {
                Children = {
                    webView
                }
            }
        };
    }

Viewing all articles
Browse latest Browse all 91519

Trending Articles



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