admin管理员组

文章数量:1403084

I've got a request from a customer to automatically detect the type of mobile device (not the browser, the type. ex: Moto Q, Blackjack II, etc.) and automatically select the device from a drop down with a list of supported devices.

So far I've found that the HTTP Headers (submitted by mobile IE) contain information such as

  • Resolution
  • UA-CPU (i've seen ARM from WM 2003 and x86 from WM5)
  • User Agent (which basically just says Windows CE)

The only thing I can think of right now is possibly using a bination of the resolution/cpu and making a "best guess"

Any thoughts?

I've got a request from a customer to automatically detect the type of mobile device (not the browser, the type. ex: Moto Q, Blackjack II, etc.) and automatically select the device from a drop down with a list of supported devices.

So far I've found that the HTTP Headers (submitted by mobile IE) contain information such as

  • Resolution
  • UA-CPU (i've seen ARM from WM 2003 and x86 from WM5)
  • User Agent (which basically just says Windows CE)

The only thing I can think of right now is possibly using a bination of the resolution/cpu and making a "best guess"

Any thoughts?

Share Improve this question edited May 1, 2009 at 9:02 bignose 32.4k16 gold badges80 silver badges116 bronze badges asked Oct 1, 2008 at 16:05 Ken SykoraKen Sykora 1,18413 silver badges28 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

You may want to have a look at WURFL, here: http://wurfl.sourceforge/.

From the site:

So... What is WURFL? The WURFL is an XML configuration file which contains information about capabilities and features of many mobile devices.

The main scope of the file is to collect as much information as we can about all the existing mobile devices that access WAP pages so that developers will be able to build better applications and better services for the users.

What exactly does the customer mean by "supported". Surely it means that the phone in question supports the web application and it's inner functionality - wouldn't it be better then to forget device detection and simply focus on detecting those capabilities required for the app to function properly? For example, if my mobile website requires Ajax to work then instead of listing all the devices which are said to "support Ajax" I could do some simple object detection to find out for myself.

Device detection, just like browser detection is unreliable. Yes, it's possible but I wouldn't reend it... on a project I've done we used the User Agent string to detect various devices. The indexOf javaScript method came in handy! :)

Another fast and easy solution is Apache Mobile Filter: http://www.apachemobilefilter

本文标签: Possible to detect the *type of mobile device* via javascript or HTTP HeadersStack Overflow