2011-04-04 63 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中的瀏覽器時,我發現這非常有用,因爲它們甚至會分解您應該能夠解析的內容。