Home > Blockchain >  WebView doesn't load fully and doesn't react in Android
WebView doesn't load fully and doesn't react in Android

Time:02-14

I have a WebView in Android and am trying to load this website: https://www.zomato.com/mount-kembla-nsw/rubys-mount-kembla-mount-kembla/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop

The problem is that the loading bar gets stuck towards the end and the "Continue in app" and "Continue in browser" show, but nothing happens when clicked. I can scroll the WebView, but it's greyed out and not loaded fully. This is my code:

val webView = binding.webView

webView.post {
                webView.settings.allowContentAccess = true
                webView.settings.loadWithOverviewMode = true
                webView.settings.useWideViewPort = true
                webView.settings.builtInZoomControls = true
                webView.settings.allowFileAccess = true
                webView.settings.domStorageEnabled = true
                webView.settings.cacheMode = WebSettings.LOAD_DEFAULT
                webView.settings.loadsImagesAutomatically = true

                webView.webViewClient = WebViewClient()
                webView.loadUrl(restaurantInfo.menu_url!!)
            }

Any help will be appreciated.

CodePudding user response:

try to enable javaScript in your web view with this code:

webView.settings.javaScriptEnabled=true
webView.settings.javaScriptCanOpenWindowsAutomatically=true
  • Related