Is there a way to make the WebView widget use Chrome instead of the builtin WebKit browser on Samsung/LG Android Phones?

FunkSoulBrother picture FunkSoulBrother · Aug 26, 2015 · Viewed 8.3k times · Source

When using the WebView in an Android application - Android will utilize different browsers under the hood in order to render the web page. For example - pre Android 4.4 on Samsung devices will use the WebKit based browser that comes on Samsung stock phone (even if Chrome is installed and is the default web browser). Google Nexus/HTC phones come with Chrome pre-installed and they will use it to render web content.

We have rendering problems with the WebKit browser on Samsung/LG devices with sites like Google Drive. When opened on the same device in Chrome - they render perfectly but when rendered in our application (which uses the builtin browser) - they fail to render the content.

I'm looking for a way to make the WebView use Chrome (if installed) instead of the builtin browser on the devices giving me problems.

Can anyone help?

Answer

CommonsWare picture CommonsWare · Aug 26, 2015

When using the WebView in an Android application - Android will utilize different browsers under the hood in order to render the web page.

No, WebView uses different Web rendering engines, not different browsers.

For example - pre Android 4.4 on Samsung devices will use the WebKit based browser that comes on Samsung stock phone (even if Chrome is installed and is the default web browser).

No, WebView will use WebKit on all pre-4.4 devices, not "the WebKit based browser".

Google Nexus/HTC phones come with Chrome pre-installed and they will use it to render web content.

No, WebView will use WebKit on all pre-4.4 devices, not Chrome, regardless of make or model, barring some massive manufacturer-specific modifications. I can positively state that no such modifications existed on Nexus-series devices of pre-4.4 vintage.

I'm looking for a way to make the WebView use Chrome (if installed) instead of the builtin browser on the devices giving me problems.

That is not possible. You are welcome to investigate using some other Web rendering engine (e.g., see how Mozilla's GeckoView is coming along, see if there is a Chromium port to Android that you can bake into your app), but prior to Android 4.4, there is no notion of WebView itself using some other engine. You would need to use some other API for displaying Web content, tied to the other rendering engine. Also note that using another Web rendering library will significantly increase your app size.