2011-04-04 64 views
1

下列用户代理字符串为不同的浏览器比较:.NET用户代理解析

IE8

的Mozilla/4.0(兼容; MSIE 8.0;的Windows NT 6.1; WOW64;三叉戟/ 4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;媒体中心PC 6.0; .NET4.0C; InfoPath.3; .NET4.0E)

Firefox 3

Mozilla/5.0(Windows; U; Windows NT 6.1; EN-US; RV:1.9.2.16)的Gecko/20110319 的Firefox/3.6.16

铬10

的Mozilla/5.0(窗口; U; Windows NT的6.1; EN-US)为AppleWebKit/534.16(KHTML,例如Gecko)铬/ 10.0.648.204 Safari浏览器/ 534.16


我看到有Firefox和Chrome浏览器在显示浏览器名称(在上面的示例中以粗体显示)是一致的,但IE显示它在字符串中完全不同的位置... HttpBrowserCapabilitiesBase类如何解析此字符串?我怎样才能使用这个解析器(或一个自定义的)来处理Wurfl库?(例如,我无法找到USER_AGENT =“IE6”在任何地方存储库,而这是在Win移动使用)

这些都是从Request对象的.NET HttpBrowserCapabilitiesBase类的变量。

IE8

Browser Capabilities Type = IE8 
Name = IE 
Version = 8.0 
Major Version = 8 
Minor Version = 0 
Platform = WinNT 
Is Beta = False 
Is Crawler = False 
Is AOL = False 
Is Win16 = False 
Is Win32 = True 
Supports Frames = True 
Supports Tables = True 
Supports Cookies = True 
Supports VBScript = True 
Supports JavaScript = 3.0 
Supports Java Applets = True 
Supports ActiveX Controls = True 
Supports JavaScript Version = 1.5 

火狐3

Browser Capabilities Type = Firefox3 
Name = Firefox 
Version = 3.6 
Major Version = 3 
Minor Version = 6 
Platform = WinNT 
Is Beta = False 
Is Crawler = False 
Is AOL = False 
Is Win16 = False 
Is Win32 = True 
Supports Frames = True 
Supports Tables = True 
Supports Cookies = True 
Supports VBScript = False 
Supports JavaScript = 3.0 
Supports Java Applets = True 
Supports ActiveX Controls = False 
Supports JavaScript Version = 1.8 

铬10

Browser Capabilities Type = Chrome10 
Name = Chrome 
Version = 10.0 
Major Version = 10 
Minor Version = 0 
Platform = WinNT 
Is Beta = False 
Is Crawler = False 
Is AOL = False 
Is Win16 = False 
Is Win32 = True 
Supports Frames = True 
Supports Tables = True 
Supports Cookies = True 
Supports VBScript = False 
Supports JavaScript = 3.0 
Supports Java Applets = True 
Supports ActiveX Controls = False 
Supports JavaScript Version = 1.7 

回答

0

我偶然发现了这个问题,并没有看到MDN Browser Detection using the User Agent参考。当我试图检测ASP.NET中的浏览器时,我发现这非常有用,因为它们甚至会分解您应该能够解析的内容。