void SetupControl()
        {
            var webView = new Android.Webkit.WebView(Forms.Context);

            _callback = new JavascriptValueCallback(this);

            // https://github.com/SKLn-Rad/Xam.Plugin.WebView.Webview/issues/11
            webView.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);

            // Defaults
            if (webView.Settings == null)
            {
                return;
            }
            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.DomStorageEnabled = true;
            webView.AddJavascriptInterface(new FormsWebViewBridge(this), "bridge");
            webView.SetWebViewClient(new FormsWebViewClient(this));
            webView.SetWebChromeClient(new FormsWebViewChromeClient(this));
            webView.SetBackgroundColor(Android.Graphics.Color.Transparent);

            FormsWebView.CallbackAdded += OnCallbackAdded;

            SetNativeControl(webView);
            OnControlChanged?.Invoke(this, webView);
        }
        void SetupControl()
        {
            _webView  = new WebViewEx(Forms.Context);
            _callback = new JavascriptValueCallback(this);

            // https://github.com/SKLn-Rad/Xam.Plugin.WebView.Webview/issues/11
            _webView.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);

            // Defaults
            _webView.Settings.JavaScriptEnabled = true;
            _webView.Settings.DomStorageEnabled = true;
            _webView.Settings.AllowFileAccess   = true;
            _webView.Settings.AllowUniversalAccessFromFileURLs = true;
            _webView.Settings.AllowFileAccessFromFileURLs      = true;
            _webView.AddJavascriptInterface(new FormsWebViewBridge(this), "bridge");
            _webView.SetWebViewClient(new FormsWebViewClient(this));
            _webView.SetWebChromeClient(new FormsWebViewChromeClient(this, (Activity)Forms.Context));
            _webView.SetBackgroundColor(Android.Graphics.Color.Transparent);

            FormsWebView.CallbackAdded += OnCallbackAdded;

            SetNativeControl(_webView);
            SetUserAgent();
            OnControlChanged?.Invoke(this, _webView);
        }
        internal async Task <string> OnJavascriptInjectionRequest(string js)
        {
            if (Element == null || Control == null || Control.Disposed)
            {
                return(string.Empty);
            }

            var callback = new JavascriptValueCallback(this);

            var response = string.Empty;

            Device.BeginInvokeOnMainThread(() => {
                if (Control == null || Control.Disposed)
                {
                    return;
                }
                Control.EvaluateJavascript(js, callback);
            });

            // wait!
            await Task.Run(() =>
            {
                while (callback.Value == null)
                {
                }

                using (callback)
                {
                    // Get the string and strip off the quotes
                    if (callback.Value is Java.Lang.String)
                    {
                        // Unescape that damn Unicode Java bull.
                        response = Regex.Replace(
                            callback.Value.ToString(),
                            @"\\[Uu]([0-9A-Fa-f]{4})",
                            m => char.ToString((char)ushort.Parse(m.Groups[1].Value, NumberStyles.AllowHexSpecifier)));
                        response = Regex.Unescape(response);

                        if (response.Equals("\"null\""))
                        {
                            response = null;
                        }

                        else if (response.StartsWith("\"") && response.EndsWith("\""))
                        {
                            response = response.Substring(1, response.Length - 2);
                        }
                    }
                }
            });

            // return
            return(response);
        }