Hello,
Welcome to our Microsoft Q&A platform!
Based on your description and error, please enable the SetAcceptThirdPartyCookies
for your webview in custom renderer.
[assembly: ExportRenderer(typeof(Xamarin.Forms.WebView), typeof(HybridWebViewRenderer))]
namespace App117.Droid
{
class HybridWebViewRenderer : WebViewRenderer
{
public HybridWebViewRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.WebView> e)
{
base.OnElementChanged(e);
var webView=Control as Android.Webkit.WebView;
webView.Settings.JavaScriptEnabled = true;
webView.Settings.SaveFormData = true;
webView.Settings.SetAppCacheEnabled(true);
CookieManager cookieManager = CookieManager.Instance;
cookieManager.SetAcceptCookie(true);
CookieManager.Instance.SetAcceptThirdPartyCookies(webView, true);
webView.SetWebViewClient(new MyWebviewClient());
}
}
internal class MyWebviewClient : WebViewClient
{
public override bool ShouldOverrideUrlLoading(Android.Webkit.WebView view, string url)
{
view.LoadUrl(url);
return true;
}
}
}
Best Regards,
Leon Lu
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.