随着Android设备增多,不少网站都开始设备Android设备,而Android主流设备类型以手机和平板为主。网站在适配时通过User Agent(用户代理,以下简称UA)又如何区分呢,本文部分内容翻译自Google官方博客Mo’ better to also detect “mobile” user-agent。
一针见血
标准判断规则:Mobile Android has “Mobile” string in the User-Agent header. Tablet Android does not.
在Android设备UA字符串中,移动设备包含Mobile字符串,而平板设备没有。