WebViewClient主要帮助WebView处理各种通知请求事件的,比如

onLoadResource
onPageStart
onPageFinish
onReceiveError
onReceivedHttpAuthRequest

WebChromeClient主要辅助WebView处理Javascript的对话框网站图标、网站title加载进度比如

onCloseWindow(关闭WebView)
onCreateWindow()
onJsAlert (WebView上alert无效需要定制WebChromeClient处理弹出)
onJsPrompt
onJsConfirm
onProgressChanged
onReceivedIcon
onReceivedTitle

推荐框架:AgentWeb

https://github.com/Justson/AgentWeb/

Android WebView中WebViewClient与WebChromeClient区别 – 365建站网

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注