I need to pass a query string into a WebView Xamarin Source on Navigating (www.websiteexmple.com?mobileapp=true).
In Android works perfect, but in IOS does not seems to work correctly sometimes . I am missing someting ?
I have notice it does not work in IOS when Net Core website needs to do some redirects : Ex: User Enter Email and click Next Step.
public void WebView_NavigatingAsync(object sender, WebNavigatingEventArgs args)
{
if (!args.Url.Contains(Source) && !args.Url.Contains("facebook") && !args.Url.Contains("google"))
{
var uri = new Uri(args.Url);
// Device.OpenUri(uri);
Launcher.OpenAsync(uri);
args.Cancel = true;
}
else
{
var src = args.Url;
string prefix = "?";
if (src.Contains("?"))
{
prefix = "&";
}
if (!args.Url.Contains("mobileapp=true"))
{
args.Cancel = true;
var webview = (WebView)sender;
webview.Source = src + prefix + "mobileapp=true";
}
}
}
args.Url.Containsdoes not work ?