public CustomWebView(Android.Webkit.WebView webView)
        {
            this.webView  = webView;
            valueCallback = new JavascriptValueCallback(this);

            var customWebViewClient = new CustomWebViewClient(GetType().Assembly);

            customWebViewClient.onPageFinishedCustom += CustomWebViewClient_onPageFinishedCustom;
            webView.SetWebViewClient(customWebViewClient);

            webView.AddJavascriptInterface(new CustomWebViewJSBridge(this), "jsBridge");
            webView.ClearCache(true);
            webView.ClearHistory();
            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.JavaScriptCanOpenWindowsAutomatically = true;
            webView.Settings.DomStorageEnabled = true;

            global::Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true);
        }
Example #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <WebView> e)
        {
            base.OnElementChanged(e);

            Android.Webkit.WebView webView = Control;
            if (webView == null)
            {
                return;
            }

            if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop)
            {
                Android.Webkit.CookieManager.Instance.RemoveAllCookie();
            }
            else
            {
                Android.Webkit.CookieManager.Instance.RemoveAllCookies(this);
            }

            webView.ClearCache(true);
            webView.ClearHistory();
            webView.ClearFormData();
            webView.ClearMatches();
        }