stha2049
stha2049

Reputation: 43

Webview showing blank page after recent chrome update

I know this problem has been already asked before but I am not able to solve it. I'm trying to play embed video URL on the Webview and filter other bad URLs through shouldOverrideUrlLoading.Whenever the embed video play icon is clicked, about blank is called and a blank page is loaded.Previously before the update, everything was working normally and all of a sudden I faced this problem. The problem is only seen on some of the devices.

Here is my Webview code:

 WebSettings webSettings = mWebView.getSettings();
            webSettings.setJavaScriptEnabled(true);
            mWebView.getSettings().setDomStorageEnabled(true);
            mWebView.setWebChromeClient(new MyWebChromeClient(this));
            mWebView.setWebViewClient(new WebViewClient() {

                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    if (url.contains("myserverUrl1.co/") ||url.contains("myserverUrl2.to/")) {
                        Log.e("first", url);
                            view.loadUrl(url);
                    }
                    Log.e("videoUrl", url);
                    return true;
                }

                @Override
                public void onPageStarted(WebView view, String url, Bitmap favicon) {
                    super.onPageStarted(view, url, favicon);
                    Log.e("page started", url);
                }

                @Override
                public void onPageFinished(WebView view, String url) {
                    super.onPageFinished(view, url);
                    Log.e("finished", "finished loading" + url);

                }

                Log.e("url final load", url);
                mWebView.loadUrl(url);
                mWebView.addJavascriptInterface(new MyJavaScriptInterface(this), "HtmlViewer");

And here is my Logcat

 E/url final load: https://myserverUrl1.co/embed/_KNy4THqon4
 E/page started: https://myserverUrl1.co/embed/_KNy4THqon4
 E/finished: finished loadinghttps://myserverUrl1.co/embed/_KNy4THqon4
 E/page started: about:blank
 E/videoUrl: http://syndication.exosrv.com/splash-zones-split.php?st=ref&main_zone=2792946&type=8&sub=5&ref=https%3A%2F%2Fopenload.co
 E/finished: finished loading about:blank

Please help me fix this issue. Thanks

Upvotes: 1

Views: 1978

Answers (1)

stha2049
stha2049

Reputation: 43

These are the bunch of settings which solved my problem

 WebSettings webSettings = mWebView.getSettings();
            webSettings.setJavaScriptEnabled(true);
            mWebView.getSettings().setDomStorageEnabled(true);
            mWebView.getSettings().setLoadWithOverviewMode(false);
            mWebView.getSettings().setAllowFileAccess(true);
            mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
            mWebView.getSettings().setSupportMultipleWindows(true);
            mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
            mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);

and in the manifest file inside application added

    android:hardwareAccelerated="true"

Upvotes: 3

Related Questions