Search code examples
androidandroid-webviewuser-agent

Android, webview user agent vs browser user agent


I'm building my website and I want to know whether the user is using Android's browser or an app with a webview.

is it possible ??


Solution

  • FROM: http://googlewebmastercentral.blogspot.com/2011/03/mo-better-to-also-detect-mobile-user.html

    With a User-Agent like this:

    Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13

    since there is no “mobile” string, serve this user the desktop version (or a version customized for Android large-screen touch devices). The User-Agent tells us they’re coming from a large-screen device, the XOOM tablet.

    On the other hand, this User-Agent:

    Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; Nexus One Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1

    contains “mobile” and “android,” so serve the web surfer on this Nexus One the mobile experience!

    FROM https://stackoverflow.com/a/7327201

    it looks like the User-Agent is the same in webview as in the default mobile browser