﻿# 介紹好用網站：UserAgentString.com

每個瀏覽器都會送出不同的 User-Agent 標頭(HTTP Header)，當在開發網站時有時為了依據不同的瀏覽器來提供不同的服務時，都會特別寫程式比對瀏覽器的種類與版本，這簡單的判斷在 ASP.NET 或 jQuery 都已經有現成的物件可用，不需特別去查表，但有時我會想查詢這瀏覽器的各版本到底用了哪些字串表示，我就會上這個 [UserAgentString.com](http://www.useragentstring.com/) 網站查詢。

[這裡](http://www.useragentstring.com/pages/useragentstring.php)有為數眾多的 User-Agent 列在這裡，而且資訊非常詳細，像我之前為了查出 IE6 特定版本無法處理 gzip 壓縮網頁的情況，就是將網路上查到的解決方案與這網站提供的資訊做出比對、驗證，才能確定發生問題的 IE6 特定版本，並修改程式以避開有問題的 IE6 瀏覽器。

若以 Internet Explorer 為例，這裡就列出非常多 User-Agent 的版本：

-   [http://www.useragentstring.com/pages/Internet%20Explorer/](http://www.useragentstring.com/pages/Internet%20Explorer/ "http://www.useragentstring.com/pages/Internet%20Explorer/")

再以 [Mozilla/4.0 (compatible; U; MSIE 6.0; Windows NT 5.1)](http://www.useragentstring.com/Internet%20Explorer6.0_id_10200.php) 為例，可得到以下資訊：

[![Mozilla/4.0 (compatible; U; MSIE 6.0; Windows NT 5.1)](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/233588d7ba955271c7c5-image_thumb.png "Mozilla/4.0 (compatible; U; MSIE 6.0; Windows NT 5.1)")](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/3844ac8655b07e1f7980-image.png)

當你從網頁伺服器的 Log 得到任何一個 User-Agent 字串，也可以在上圖的文字輸入框貼上，然後點擊 \[**Analyze**\] 按鈕進行分析，非常的方便。

由於要處理無法見面且不熟悉電腦操作的使用者，透過這種方式分析使用者的電腦環境也算是個有不錯的方式，甚至可以進一步建議使用者安裝特定軟體(如微軟提供的更新軟體)解決他電腦本身的問題。

**相關連結**

-   [UserAgentString.com](http://www.useragentstring.com/)
-   [UserAgentString.com - List of User Agent Strings](http://www.useragentstring.com/pages/useragentstring.php)
-   [Understanding User-Agent Strings](http://msdn.microsoft.com/en-us/library/ms537503%28VS.85%29.aspx) ( MSDN )
-   [User Agent Strings Reference – MDC](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Browser_detection_using_the_user_agent)
-   [History of the browser user-agent string](http://webaim.org/blog/user-agent-string-history/)
