'Android WebView not loading the pop up dialog content

I'm trying to open an url using webView, but I'm not able to see the country list when i open via AndroidWebView but same link working when i open with chrome tab. I was experimenting all these settings non help,

    WebView(context).apply {
        with(settings) {
            builtInZoomControls = true
            displayZoomControls = true
            javaScriptEnabled = true
            domStorageEnabled = true
            allowFileAccess = true
            loadWithOverviewMode = true
            useWideViewPort = true
            setSupportZoom(true)
            setSupportMultipleWindows(true)
            javaScriptCanOpenWindowsAutomatically = true
            setInitialScale(1)
            setAppCacheEnabled(false)
            pluginState = WebSettings.PluginState.ON
            userAgentString =
                "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Mobile Safari/537.36";
        }

        WebView.setWebContentsDebuggingEnabled(true)

webView chrome tab



Solution 1:[1]

You must provide a chrome client that can handle alerts:

One should use a WebChromeClient to get these alerts and the functionality can be overwritten using theonJsAlert() method. Hope this helps!

WebView wv=new WebView(this);   
wv.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);
              }
  });

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sharmaDev2506