I'm using WebView inside jetpack compose project. The project is about server-driven UI where one of component returns String as HTML. HTML inside contains <a href> tag, which on click should open URL on default browser or open.
To handle that event, I overrided the function shouldOverrideUrlLoading. The problem is when I click on that tag, it opens a blank page inside WebView. I captured the WebResourceRequest.url property inside and it returns about:blank#blocked. I tried to play a little bit with WebSettings inside WebView but it didn't help. Also tried to capture errors with possible ssl certificate problems, but didn't find any solution either.
Here is the code:
AndroidView(factory = {
            WebView(context).apply {
                with(this.settings){
                    this.allowContentAccess = true
                }
                webViewClient = object : WebViewClient() {
                    override fun shouldOverrideUrlLoading(
                        view: WebView?,
                        request: WebResourceRequest?
                    ): Boolean {
                        Log.d("url0", request?.url.toString()) //returns about:blank#blocked
                        return if (url != null && (url!!.startsWith("http://") || url!!.startsWith("https://"))) {
                            //open page in browser
                            true
                        } else if (url != null && (url!!.startsWith("mailto:"))) {
                            //handle email
                            true
                        } else {
                            false
                        }
                    }
loadDataWithBaseURL(null, "<a href=\\\"https://en.wikipedia.org/wiki/Log4j\\\">This is sample data</a>.", "text/html", "UTF-8", null)