Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is there a way to detect whether user is accessing your website from android powered tablet or phone on the server side?

I don't own any android devices, so it's not possible for me to test what kind of headers those devices send.

In my research I found: - many ways to detect it using javascript. But thats (IMHO) not the best moment, when you decide what web version should be sent to client. I prefer to server each version based on http headers sent by client. - database of http headers collected and sorted by device type. But can I rely on this? Also there are paid solution that can be more realibe, but I prefer free solutions.

Is there any other solution? Can you recommend one? And why?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
219 views
Welcome To Ask or Share your Answers For Others

1 Answer

They mentioned this on the developer blog when tablets first came out:

http://android-developers.blogspot.com/2010/12/android-browser-user-agent-issues.html

The only difference is that "Mobile" is removed from the user agent.

Edit: These are the user agents for the Galaxy Tab and Flyer

Mozilla/5.0 (Linux; U; Android 3.1; en-us; GT-P7510 Build/HMJ37) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13

Mozilla/5.0 (Linux; U; Android 3.2.1; en-gb; HTC Flyer P510e Build/HTK75C) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...