简体   繁体   中英

Webview showing unwanted dialog

I am trying to open webpage in webview. Page loaded successfully but sometimes it shows dialog to install UC browser as display in below screen.

Screenshot of Dialog

在此处输入图片说明

Below is Code:

webView=(WebView)findViewById(R.id.webView);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebChromeClient(new WebChromeClient() {
            @Override
            public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
                //Required functionality here
                return super.onJsAlert(view, url, message, result);
            }

        });


        if (Build.VERSION.SDK_INT >= 19) {
            webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        }

        webView.setWebViewClient(new AppWebViewClients());
        webView.loadUrl("page_url");

I have to enable java script because there are few validation in page.

please try using this

public void setWebViewClient(WebViewClient client) {
mWebViewClient = client;

}

instead of setWebChromeClient

if you are developing a WebView that won't require too many features but rendering HTML, you can just use a WebViewClient

try this to webview

webView.getSettings().setPluginsEnabled(true);
    webView.getSettings().setAllowFileAccess(true);
    webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);

I asked some other guy who had exactly same issue, maybe you can try :

  • Check Server side JS file or any other plugin
  • Check if any other installed app, which package name like com.UCMobile. , try to disable or uninstall them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM