Android, webview user agent vs browser user agent

前端 未结 7 1038
眼角桃花
眼角桃花 2020-12-03 03:14

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 ??

7条回答
  •  隐瞒了意图╮
    2020-12-03 03:24

    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

提交回复
热议问题