2012-12-23 139 views
1

从Android设备收到网络请求时,有没有办法知道它是来自智能手机还是平板电脑?如果任何Javascript调整必须预先应用 - 也很好。Android:智能手机或平板电脑

+0

你是不是应该更关心的技术特点,营销广告词像物理屏幕大小,而不是是否用“手机”,“平板电脑”,“平板手机”,等等? – CommonsWare

+0

可能重复:http://stackoverflow.com/questions/9279111/determine-if-the-device-is-a-smartphone-or-tablet –

+0

请尝试看看这个问题:http://stackoverflow.com/问题/ 5341637/how-do-detect-android-tablet-in-general-useragent – Dimse

回答

0

基本上通过检查用户代理

this does not work in all cases (search for Mobile),但几乎所有情况下,应该在未来的版本中工作做得更好。上面唯一的例外似乎是平板电脑上使用的不常见的浏览器。

JS

var appv= navigator.appVersion.toLowerCase(); 
if(appv.search("android") > -1 && !(appv.search("mobile"))){ 
    //is android tablet 
}else if (appv.search("android") > -1){ 
    //is android phone 
} 
相关问题