I'm developing an app for my client and have configured a WebView in my Xamarin.forms application. How do I handle errors (like Address Unreachable, no internet, etc..)
I have added try clause and catch exception. But it doesn't work and the default unreachable page comes on android and a blank page on iOS if there is no Internet
try{WebView.Source = "example.com";}
catch (Exception){var htmlSource = new HtmlWebViewSource();
htmlSource.Html = @"
An Error!!!!
Could not be loaded
";
WebView.Source = htmlSource;}
I expect "This page could not be loaded" but instead I see the original android error page: "net::ERR_ADDRESS_UNREACHABLE"
BTW - I had to put example.com cuz forum was not letting me put links... and An Error!!!! is in H1, but it loaded incorrectly (rendered on the forum itself😐