When receiving a web request from an Android device, is there a way to know if it comes from a smartphone or from a tablet? If any Javascript tweak must be pre-applied - good as well.
Asked
Active
Viewed 338 times
1
-
Shouldn't you care more about technical characteristics, like physical screen size, rather than whether the marketing blurbs use the word "phone", "tablet", "phablet", etc.? – CommonsWare Dec 23 '12 at 16:03
-
Possible Duplicate : http://stackoverflow.com/questions/9279111/determine-if-the-device-is-a-smartphone-or-tablet – Pranav 웃 Dec 23 '12 at 16:03
-
Try taking a look at this question: http://stackoverflow.com/questions/5341637/how-do-detect-android-tablets-in-general-useragent – Dimse Dec 23 '12 at 16:16
-
@PranavKapoor I am asking about the Web side, not applications. – BreakPhreak Dec 24 '12 at 08:42
-
@Dimse so the only thing is `mobile Android` vs `Android`? – BreakPhreak Dec 24 '12 at 08:43
-
It would seem like it, yes. Would love for there to be a more elegant solution, but so very few things about the internet are elegant.. – Dimse Dec 24 '12 at 23:13
-
@Dimse checked, haven't seen `mobile Android` anywhere here in reports – BreakPhreak Dec 25 '12 at 14:14
1 Answers
0
basically by checking the useragent
this does not work in all cases (search for Mobile), but almost all cases and should work in future releases even better. The only exception from above seems to be a uncommon browser that was used on the tablet.
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
}

Toskan
- 13,911
- 14
- 95
- 185