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

霸气de小男生 提交于 2019-12-05 00:59:06

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/32227552/is-there-a-way-to-make-the-webview-widget-use-chrome-instead-of-the-builtin-webk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!