I have just built a mobile site and want to redirect the traffic from our main site if the user is browsing through a mobile phone.
Currently I am using javascript to pick up the browser useragent and using that to identify if the device is a mobile phone.
The issue I have is with Android devices as I cannot find a distinguishing feature for Android useragents to decide whether the device is a phone or a tablet, If the user is on a tablet I still want to show them the full site.
Does anyone know of a solution for this?
I have just built a mobile site and want to redirect the traffic from our main site if the user is browsing through a mobile phone.
Currently I am using javascript to pick up the browser useragent and using that to identify if the device is a mobile phone.
The issue I have is with Android devices as I cannot find a distinguishing feature for Android useragents to decide whether the device is a phone or a tablet, If the user is on a tablet I still want to show them the full site.
Does anyone know of a solution for this?
Share Improve this question asked Aug 24, 2011 at 10:05 user840533user840533 1731 gold badge1 silver badge4 bronze badges2 Answers
Reset to default 17You should probably use this sugestion made by google by reading the user agent. If the UA has the word mobile it's a phone, if it doesn't it's a tablet
http://googlewebmastercentral.blogspot.com/2011/03/mo-better-to-also-detect-mobile-user.html
There is no general way of doing this: read this article for more explanation http://www.webvanta.com/post/2012-04-08/how-to-reliably-tell-android-tablets-from-phones
quoting the article in case you dont have the time "Depending on the phone manufacturer and the browser in use, there are phones that don’t include “mobile” in the UA string, and tablets that do"
That is true at lease for tablets, IPads have the word mobile in user agent (for some version of chrome and safari)