I am trying to load a web url in my app which is a login page. On entering the details and after authentication it is supposed to return a token . I have used EvaluateJavascript property in HybridWebView . This is working completely fine in iOS , whereas in Android , after the login process it throws 404 error suddenly for the past few days. All the code is same except for the renderers.I do not have a custom control instead have created the ContentViews for hybridwebview as it is prism Template.

Android Renderer.cs

public class HybridWebViewRenderer : WebViewRenderer //ViewRenderer<HybridWebView, Android.Webkit.WebView>  
    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.WebView> e)  
        base.OnElementChanged(e);  
        var webView = e.NewElement as HybridWebView;  
        if (webView != null)  
            webView.EvaluateJavascript = async (js) =>  
                var reset = new ManualResetEvent(false);  
                var response = string.Empty;  
                Device.BeginInvokeOnMainThread(() =>  
                    Control?.EvaluateJavascript(js, new JavascriptCallback((r) => { response = r; reset.Set(); }));  
                await Task.Run(() => { reset.WaitOne(); });  
                return response;  
internal class JavascriptCallback : Java.Lang.Object, IValueCallback  
    public JavascriptCallback(Action<string> callback)  
        _callback = callback;  
    private Action<string> _callback;  
    public void OnReceiveValue(Java.Lang.Object value)  
        _callback?.Invoke(Convert.ToString(value));  

In VM : I have declared EvaluateJavascript String innerHtml = await EvaluateJavascript("document.body.innerHTML");

HybridWebView Content View :

public static readonly BindableProperty EvaluateJavascriptProperty =  
            BindableProperty.Create(nameof(EvaluateJavascript),  
                typeof(Func<string, Task<string>>),  
                typeof(HybridWebView),  
                null,  
                BindingMode.OneWayToSource);  
        public Func<string, Task<string>> EvaluateJavascript  
            get { return (Func<string, Task<string>>)GetValue(EvaluateJavascriptProperty); }  
            set { SetValue(EvaluateJavascriptProperty, value); }  

calling in the VM :

string store = await EvaluateJavascript("document.body.innerHTML")  

Has anyone come across anything similar and can help me out?

Hi , It was all working good and suddenly one day it broke . I am using a third party webview for authentication and from there redirecting to a POST URL with the SAML token generated and that is the place 404 error comes . IT is same for both but iOS manages to handle it and gives us the result after EvaluateJavascript whereas Android is failing .

I am unable to share the URL as it is confidential. The web view was designed such a way like the URL was never created it was just used for redirection purpose so it was always the same and was also working fine till a month back in Android too . Suddenly , in the 404 error screen of webview , we receive the Token generated by the web view in JS to the Xamarin app. Now instead of receiving the JS after EvaluateJS method , the JS becomes null and hence the 404 message gets displayed in the app . ( No code changes were done related to this).

Since I couldn't reproduce the issue, it is recommended to open a support ticket for this. Please contact our paid phone support at MS Support.
You will get 1:1 support on that.