Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
25
rated 0 times [  28] [ 3]  / answers: 1 / hits: 18169  / 11 Years ago, fri, may 3, 2013, 12:00:00

I am working on web analytics. I am using JavaScript client-side and NodeJS server-side. I know we can find out device type using userAgent, but how do I detect the device brand (client or server side)?


More From » node.js

 Answers
7

You can't do it directly; the userAgent field simply does not contain the vendor. However you can build up a library of userAgent tokens which map to particular vendors. This will involve a lot of research and testing on a wide range of devices, though.



For example, anything with iOS, iPhone or iPad in the userAgent you can safely map to Apple.
Then the Samsung Galaxy S3, for example, has the model number in the userAgent, which is GT-I9300. You can then map this to Samsung.
...and then you'd need to repeat this for every other device you want to recognise. Looking up user agent strings online is probably the quickest way.


[#78451] Thursday, May 2, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
daijab

Total Points: 60
Total Questions: 99
Total Answers: 110

Location: Bosnia and Herzegovina
Member since Thu, Jun 24, 2021
3 Years ago
;