Search code examples
kotlinurlwebviewandroid-jetpack-compose

How to refresh Webview in Jetpack compose if url is the same?


How to refresh Webview in Jetpack compose if url is the same?

I try to use AccompanistWebViewClient and then I try to change urlState to the same webview not reloading How to reload the webview?

val urlState =
        rememberWebViewState()
    WebView(
        state = urlState,
        onCreated = { webView ->
            webView.settings.javaScriptEnabled = true
        },
        client = remember { webViewClient },
        chromeClient = remember { chromeViewClient }
    ) 

Solution

  • Call WebView again. That's because instance of WebView creating new View based on URL.

    https://medium.com/@kevinnzou/using-webview-in-jetpack-compose-bbf5991cfd14