User Agent Strings

A browser’s user agent string (UA) helps identify which browser is being used, what version, and on which operating system. When feature detection APIs are not available, use the UA to customize behavior or content to specific browser versions.

Like all other browsers, Chrome for Android sends this information in the User-Agent HTTP header every time it makes a request to any site. It’s also available in the client through JavaScript using the navigator.userAgent call.

Chrome for Android

Chrome for Android reports its UA in the following formats, depending on whether the device is a phone or a tablet.

Phone UA:

Mozilla/5.0 (Linux; <Android Version>; <Build Tag etc.>)
AppleWebKit/<WebKit Rev> (KHTML, like Gecko) Chrome/<Chrome Rev> Mobile
Safari/<WebKit Rev>

Tablet UA:

Mozilla/5.0 (Linux; <Android Version>; <Build Tag etc.>)
AppleWebKit/<WebKit Rev>(KHTML, like Gecko) Chrome/<Chrome Rev>
Safari/<WebKit Rev>

Here’s an example of the Chrome user agent string on a Galaxy Nexus:

Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B)
AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile

If you are parsing user agent strings using regular expressions, the following can be used to check against Chrome on Android phones and tablets:

  • Phone pattern: 'Android' + 'Chrome/[.0-9]* Mobile'
  • Tablet pattern: 'Android' + 'Chrome/[.0-9]* (?!Mobile)'

WebView on Android

The Android 4.4 (KitKat) Chromium-based WebView adds Chrome/_version_ to the user agent string.

Old WebView 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

WebView UA in KitKat to Lollipop

Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_) 
AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/ Mobile

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 (for example, as the version numbers changes with each release.

WebView UA in Lollipop and Above

In the newer versions of WebView, you can differentiate the WebView by looking for the wv field as highlighted below.

Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv)
AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile