What’s the difference between setWebViewClient vs. setWebChromeClient in Android?
What’s the difference between setWebViewClient vs. setWebChromeClient in Android?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the source code:
Using WebChromeClient allows you to handle Javascript dialogs, favicons, titles, and progress. Take a look of this example: Adding alert() support to a WebView
At first glance, there are too many differences between WebViewClient & WebChromeClient. But, basically: if you are developing a WebView that won’t require too many features but rendering HTML, you can just use a
WebViewClient. On the other hand, if you want to (for instance) load the favicon of the page you are rendering, you should use aWebChromeClientobject and override theonReceivedIcon(WebView view, Bitmap icon).Most of the time, if you don’t want to worry about those things… you can just do this:
And your WebView will (in theory) have all features implemented (as the android native browser).