在OnDevice就绪后,我需要检测安卓平板电脑,比如GoogleNexus7/10或三星Galaxy。
我使用device.platform,它只返回安卓,与iOS不同,它只返回iPad。
我需要知道,如果我使用下面的方法来检测Android平板电脑,如果它是Android平板电脑,它是否总是返回正确的值?
if( /epad/i.test(navigator.userAgent.toLowerCase())) {
// this is an Android tablet
}我使用的是PhoneGap 2.1和jqm1.2。
干杯和问候,马克
我发现了一种方法。你们觉得怎么样?如有任何评论,敬请:)
if ($.event.special.orientationchange.orientation() === "portrait") {
if($(window).width() > 420) {
return true;
} else {
return false;
}
} else {
if($(window).width() > 660) {
return true;
} else {
return false;
}
}发布于 2013-10-25 14:18:42
为什么不使用phonegap 设备插件呢?它有一个platform和model属性,可以帮助您。使用屏幕宽度和高度来推断设备的身份确实是不好的做法。
https://stackoverflow.com/questions/13206541
复制相似问题