일반 Understanding User-Agent Strings

황제낙엽 2011.02.22 23:41 조회 수 : 76

sitelink1  
sitelink2  
sitelink3  
sitelink4 http://1 
extra_vars4 ko 
extra_vars5 http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx 
extra_vars6 sitelink1 

Understanding User-Agent Strings

This topic describes the user-agent string, which identifies your browser and provides certain system details to servers hosting the Web sites you visit. The topic also shows how to view your user-agent string, summarizes tokens used by recent versions of Windows Internet Explorer, and documents registry keys that affect the user-agent string.

This topic contains the following sections.

Introduction

When you visit a Web page, your browser sends the user-agent string to the server hosting the site that you are visiting. This string indicates which browser you are using, its version number, and details about your system, such as operating system and version. The Web server can use this information to provide content that is tailored for your specific browser.

Because certain non-Microsoft sites add additional details to the user-agent string, it is important to understand the user-agent string. This article explains the user-agent string, lists the values from recent Internet Explorer versions, and documents registry keys that modify the user-agent string.

Understanding the User-Agent String

When you request a Web page, your browser sends a number of headers to the server hosting the site that you are visiting. Each header contains details that help the server determine the best way to provide the information that you requested. The user-agent header identifies the application requesting the information from the server. The user-agent string can contain optional details called tokens, which must be enclosed in parentheses and vary among programs. Internet Explorer uses tokens to describe additional details about your computer system.

The following figure shows a sample user-agent string reported by Internet Explorer that highlights its tokens.

Typical Internet Explorer user-agent string

For historical reasons, Internet Explorer identifies itself as a Mozilla 4.0 browser.

The sample user-agent string contains three tokens.

  1. The Compatibility flag ("compatible") is used by most modern browsers. It indicates that Internet Explorer is compatible with a common set of features.

  2. The Version token identifies the browser and contains the version number. The version token in the example ("MSIE 7.0") identifies Internet Explorer 7.

  3. The Platform token identifies your operating system and contains the version number. The platform token in the example ("Windows NT 6.0") indicates Windows Vista.

In the example, Internet Explorer is the user agent. However, other programs also provide user-agent strings when contacting servers over the Internet. For example, the Windows RSS Platform provides the following user-agent header when requesting RSS data.

Windows-RSS-Platform/1.0 (MSIE 7.0; Windows NT 5.1)

Like the user-agent string for Internet Explorer, this user-agent header provides details about your system.

Alternate tokens can appear in the user-agent string for a number of reasons; usually, they identify optional features installed on your system. For example, an "SV1" token appears in the user-agent string of a Windows XP user who has installed Windows XP Service Pack 2 (SP2). It is also important to note that certain non-Microsoft parties modify the user-agent string for their own purposes.

Note  To protect your privacy, you should periodically review your user-agent string and verify its contents.

For information on other headers communicated to Web servers, see the World Wide Web Consortium RFC2616, Section 14: Header Field Definitions.

Viewing the User-Agent String

To view your browser's user-agent string, type the following into the address bar.

javascript:alert(navigator.userAgent)

Note that this is case sensitive.

When you do this, a dialog box displays your user-agent string, as shown in the following figure.

User-agent string displayed in dialog box

Tip  If you are using a recent version of Windows, you can copy your user-agent string to the Clipboard by pressing CTRL+C before you close the dialog box.

Internet Explorer User-Agent Tokens

This section summarizes the tokens used by recent versions of Internet Explorer, which places three tokens in the user-agent string by default.

  1. Version tokens
  2. Platform tokens
  3. Feature tokens

In general, version tokens begin with MSIE and are followed by the version number of the browser. Many pre-release versions append the letter "b" to the version number. The following table lists the version tokens used in recent versions of Internet Explorer.

Version tokenDescription
MSIE 8.0Internet Explorer 8 (pre-release)
MSIE 7.0Internet Explorer 7
MSIE 7.0bInternet Explorer 7 (Beta 1 pre-release only)
MSIE 6.0Microsoft Internet Explorer 6
MSIE 6.0bInternet Explorer 6 (pre-release)
MSIE 5.5Internet Explorer 5.5
MSIE 5.01Internet Explorer 5.01
MSIE 5.0Internet Explorer 5
MSIE 5.0b1Internet Explorer 5 (pre-release)
MSIE 4.01Internet Explorer 4.01

Platform tokens describe your operating system. The following table lists Internet Explorer platform tokens for the last several versions of Windows.

Platform tokenDescription
Windows NT 6.0Windows Vista
Windows NT 5.2Windows Server 2003; Windows XP x64 Edition
Windows NT 5.1Windows XP
Windows NT 5.01Windows 2000, Service Pack 1 (SP1)
Windows NT 5.0Windows 2000
Windows NT 4.0Microsoft Windows NT 4.0
Windows 98; Win 9x 4.90Windows Millennium Edition (Windows Me)
Windows 98Windows 98
Windows 95Windows 95
Windows CEWindows CE

Certain optional components can also modify the user-agent string; the following table shows common ones. Be aware that many other applications also modify the user-agent string. Because of this, a comprehensive list is not possible. If you find additional tokens in your user-agent string, you should investigate them in more detail.

TokenDescription
.NET CLR.NET Framework common language run time, followed by the version number.
SV1Internet Explorer 6 with enhanced security features (Windows XP SP2 and Windows Server 2003 only).
Tablet PCTablet services are installed; number indicates the version number.
Win64; IA64System has a 64-bit processor (Intel).
Win64; x64System has a 64-bit processor (AMD).
WOW64A 32-bit version of Internet Explorer is running on a 64-bit processor.

User-Agent Registry Keys

When you install certain Windows components, such as the Microsoft .NET Framework or Windows XP SP2, tokens are added to the user-agent string. This is done by adding tokens to the following registry keys.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER) 
     SOFTWARE
          Microsoft
               Windows
                    CurrentVersion
                         Internet Settings
                              User Agent
                                   Pre Platform
                                        Token = Value
                                   Post Platform
                                        Token = Value

The Pre-Platform and Post-Platform keys contain values whose names appear before and after the Platform token, respectively. For example, if a string value is added to the Post-Platform key, the name appears after the platform token in the user-agent string. Multiple tokens added to either key appear in an unpredictable order.

You can also override certain tokens of the user-agent string by adding values to the following registry key.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER) 
     SOFTWARE
          Microsoft
               Windows
                    CurrentVersion
                         Internet Settings
                              5.0
                                   User Agent
                                        (default) = "Mozilla/4.0"
                                        Compatible = "compatible"
                                        Platform = "Windows NT 5.1"
                                        Version = "MSIE 6.0"
                                        Pre Platform
                                             Token = Value
                                        Post Platform
                                             Token = Value

The default value of the User-Agent key replaces the application name and application version tokens reported in the user-agent string. Note that the first seven characters are used for the application name, and the remaining characters specify the application version token.

The Compatible, Platform, and Version values replace the corresponding tokens in the user-agent string.

Additional tokens can be added to the user-agent string by using the Registry Editor to create new string values under the Pre-Platform key or Post-Platform key. The value name should be the complete token; the value data is ignored. Tokens added to the Pre-Platform key appear before the platform token in the final user-agent string. Tokens added to the Post-Platform key appear after the platform token in the final user-agent string. Multiple tokens in either the Pre-Platform key or Post-Platform key are displayed in an unpredictable order.

Note  If the browser is open when these keys are changed, the changes do not take effect until all browser windows are closed; this includes applications hosting the WebBrowser Control. Be aware that applications hosting the WebBrowser Control can override the Internet Explorer user-agent string without modifying it. For more information, see PRB: WebBrowser Control Clients Share Global Settings.
번호 제목 글쓴이 날짜 조회 수
117 Defining classes and inheritance (클래스 정의와 상속) 황제낙엽 2011.03.24 392
116 User Agent 관련 Reference URL 황제낙엽 2011.02.22 41
115 각 브라우저 별 User Agent 정보 황제낙엽 2011.02.22 823
114 History of User Agent 황제낙엽 2011.02.22 38
113 Navigator 객체란? 황제낙엽 2011.02.22 53
» Understanding User-Agent Strings 황제낙엽 2011.02.22 76
111 User Agent 정보 모음 file 황제낙엽 2011.02.22 7767
110 ActiveX 설치 여부를 검사하는 스크립트 황제낙엽 2011.02.13 4052
109 [JavaScript Tutorials] Error handling in JavaScript using try/catch/finally - The Error object and throwing your own errors (해석중) 황제낙엽 2009.04.10 82
108 [JavaScript Tutorials] More leakage patterns (해석중) 황제낙엽 2009.04.10 142
107 [JavaScript Tutorials] Introducing the closure (해석중) 황제낙엽 2009.04.10 555
106 [JavaScript Tutorials] JavaScript and memory leaks (해석중) 황제낙엽 2009.04.08 102
105 [JavaScript Tutorials] Handling runtime errors in JavaScript using try/catch/finally (해석중) 황제낙엽 2009.04.08 2784
104 JavaScript Closures for Dummies 황제낙엽 2009.04.08 227
103 자바스크립트 예약어 황제낙엽 2010.11.03 35
102 YUI Logger(Yahoo) 를 동적으로 로드하는 북마크릿 황제낙엽 2010.10.03 25
101 Javascript 를 사용하여 Binary File 읽기 황제낙엽 2010.09.29 499
100 크로스 브라우저를 위한 브라우저 검사 코드 file 황제낙엽 2010.08.27 86
99 Dynatrace For Ajax Performance 황제낙엽 2010.08.18 45
98 javascirpt IME-Mode 설정하기 황제낙엽 2010.08.17 1112