Distinguish between iPhone web browser and iPhone app user agent

左心房为你撑大大i 提交于 2019-11-28 08:28:21

I believe user agents from the Safari app start with "Mozilla", while user agents from apps start with the name of the app.

Open SEO

It seems that iPhone Apps using the UIWebKit HTTP request component have user agent string like the following

Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_1 like Mac OS X; fr-fr) AppleWebKit/532.9 (KHTML, like Gecko) Mobile/8A306
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; fr-fr) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7D11
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; fr-fr) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7E18

While Safari on iPhone has mostly the same string but ending with " Safari/XXX"

However, it is also possible to change the user agent of UIWebKit then there is no guarantee that you'll grab every iPhone app by proceeding this way.

Indeed the user agent will be different.

in PHP, you can find out with this: $_SERVER['HTTP_USER_AGENT']

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