From f4ed265f18396da0aae18fb2f47252c697ac5313 Mon Sep 17 00:00:00 2001 From: 821938089 <821938089@qq.com> Date: Mon, 18 Jul 2022 15:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/login/WebViewLoginFragment.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/login/WebViewLoginFragment.kt b/app/src/main/java/io/legado/app/ui/login/WebViewLoginFragment.kt index 0401a1fd9..19871c6b4 100644 --- a/app/src/main/java/io/legado/app/ui/login/WebViewLoginFragment.kt +++ b/app/src/main/java/io/legado/app/ui/login/WebViewLoginFragment.kt @@ -6,10 +6,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import android.view.View -import android.webkit.CookieManager -import android.webkit.WebSettings -import android.webkit.WebView -import android.webkit.WebViewClient +import android.webkit.* import androidx.fragment.app.activityViewModels import io.legado.app.R import io.legado.app.base.BaseFragment @@ -88,6 +85,16 @@ class WebViewLoginFragment : BaseFragment(R.layout.fragment_web_view_login) { super.onPageFinished(view, url) } } + binding.webView.webChromeClient = object : WebChromeClient() { + override fun onJsAlert( + view: WebView?, + url: String?, + message: String?, + result: JsResult? + ): Boolean { + return super.onJsAlert(view, url, message, result) + } + } source.loginUrl?.let { binding.webView.loadUrl(it, source.getHeaderMap(true)) }