WebView for Android
If you're a web developer looking to start developing a WebView-based Android application, see Getting Started: WebView-based Applications for Web Developers.
For tips on scaling WebView content for mobile devices, see Pixel-Perfect UI in the WebView.
The new WebView also supports remote debugging using the Chrome DevTools.
What version of Chrome is it based on?
The WebView shipped with Android 4.4 (KitKat) is based on the same code as Chrome for Android version 30. The WebView does not have full feature parity with Chrome for Android and is currently given the version number 188.8.131.52.
Will the new WebView auto-update?
Evergreen browsers (like Chrome and Firefox) auto-update and keep their users up to date so they can view the web through a modern feature set. As a developer, this ensures your choices aren’t limited to a lowest-common denominator browser from years ago, but rather are keeping pace with the modern web. Your apps inside a WebView are just as important and deserve a runtime that keeps users up to date. There are large engineering and logistical challenges. We're not quite there yet, but we're working on it.
What is the default user-agent?
The new WebView adds Chrome/_version_ to the user-agent string. Sample old and new user-agent strings:
Old UA: Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; Build/KLP) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30
New UA: Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/184.108.40.206 Mobile Safari/537.36
If you're attempting to differentiate between the WebView and Chrome for Android, you should look for the presence of the Version/_X.X_ string in the WebView user-agent string. Don't rely on the specific Chrome version number, 220.127.116.11 as this may change with future releases.
How do I set the user-agent of the WebView?
You can set the user-agent by using the Java setUserAgentString method. This method only changes the user-agent string for requests sent by the WebView itself.
You can't set the user-agent string used for
requests always use the default user-agent string.
Does this mean Chrome for Android is using the WebView?
Does the new WebView have feature parity with Chrome for Android?
For the most part, features that work in Chrome for Android should work in the new WebView.
Chrome for Android supports a few features which aren't enabled in the WebView, including:
- WebGL 3D canvas
- Fullscreen API
- Form validation
- File input type
- Filesystem API
What does the new WebView mean for developers?
There are some changes that will affect existing apps.
If you are currently using
content:// URLs to load files from a content provider
in your application, note that these URLs only work when accessed from local content. That is, web
content hosted outside your application is not allowed to access files built into your application.
There are a small number of other changes that might impact your application. Read the migration guide for more information.
How do I enable remote debugging?
See the remote debugging guide.
Does the WebView support the Chrome Apps APIs?
No. The Chrome Apps platform isn't yet supported on Android.
Should I enable hardware acceleration?
Hardware acceleration is enabled by default. If you are explicitly disabling it for older versions of Android you should try enabling it for KitKat based devices and see if it improves performance.