有没有一种简单的方法可以从用户代理字符串中检测手机/平板电脑的制造商?我还没有找到关于每个制造商字符串特征的任何来源,并且我假设可能有三星设备的示例,其中“samsung”不是字符串的一部分,但我可能错了。
我已经注意到WURFL,但这对我的需求来说太过分了。
对于它的价值,我在 .Net 3.5 环境中工作。
有没有一种简单的方法可以从用户代理字符串中检测手机/平板电脑的制造商?我还没有找到关于每个制造商字符串特征的任何来源,并且我假设可能有三星设备的示例,其中“samsung”不是字符串的一部分,但我可能错了。
我已经注意到WURFL,但这对我的需求来说太过分了。
对于它的价值,我在 .Net 3.5 环境中工作。
As you correctly pointed out, the problem with parsing user agents for information like that is that there is no guarantee on what information is included in the user-agent. Additionally, different apps will use different codes for the information they want in the user agent.
As an example, I've been looking into user agents and some are just empty strings, so you don't even know the app that made the request (unless can be deduced from domain etc.).
A simple naive approach is to parse the user agent string for strings like "iPhone", "samsung", "htc" etc. However, as indicated above this won't work all the time, however, it will work for browser user agents (there's quite a bit of information about these around).