`
shuaigg.babysky
  • 浏览: 552603 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

IE的UA

阅读更多

http://tieba.baidu.com/f?kz=192127084

 

 

以Win XP/IE6为例,根据我的理解我来简介一下IE user-agent的生成,不对之处请指正。
首先,IE的缺省标示为:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
该标示共有4个部分,它们对应的注册表项分别为:
Mozilla/4.0 -- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\(Default)
compatible -- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Compatible
MSIE 6.0 -- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Version
Windows NT 5.1 -- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Platform

 


一般情况下,这4个注册表项均为空,IE会使用缺省值。当然,比如Windows版本,肯定是通过Win32 API来获取的,如GetVersionEx。最终用户或者程序里面可以通过修改这些注册表键值达到修改IE标示的目的。

再说一下那些附加的字符串。比如在我的机器上,完整的标示为:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)
比起上面缺省标示多了3项:SV1; Maxthon; .NET CLR 1.1.4322
其中前面两项是放在这里面的:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform
其中SV1是XP SP2加上去的,因为SP2加了一些安全特性(如防火墙,安全中心什么的),SV1表示Security Version 1。Maxthon加上的一项就不用说了。
最后一项(.NET CLR 1.1.4322)是放在这里面的:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform
这个自然是安装.NET Framework后加上的。

注意这里的Post Platform都只用注册表键名就可以了,不用设置键值。

IE启动的时候就会依序读取以上注册表键,然后拼起来就可以生成User-Agent字符串了  
这个User-Agent字符串会被IE保留在内存中,每次发送HTTP请求的时候加上。所以IE只有启动的时候才会读取这些注册表键,如果你修改了某项,需要关掉IE重开才能生效。

 

 

http://www.cnblogs.com/whyandinside/articles/1544181.html

Understanding User-Agent Strings

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.
The following figure shows a sample user-agent string reported by Internet Explorer that highlights its tokens.

A 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.
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

我在Internet Settings\User Agent\Pre Platform下添加HelloPrePlatform,在Internet Settings\User Agent\Post Platform下添加HelloPostPlatform,在Internet Settings\5.0\User Agent\Pre Platform下添加Hello5.0PrePlatform,在Internet Settings\5.0\User Agent\Post Platform下添加Hello5.0PostPlatform,在Internet Settings\User Agent下添加HelloUserAgent,在Internet Settings\5.0\User Agent下添加Hello5.0UserAgent查看IE的useragent的结果是

HelloUserAgent
Mozilla/4.0 (compatible; MSIE 8.0; HelloPrePlatform; Windows NT 6.1; Trident/4.0; MS-OC 4.0; HelloPostPlatformSLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; CIBA; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; Hello5.0PostPlatform)
italics tokens are all in Internet Settings\5.0\User Agent\Post Platform

 

 

http://blog.csdn.net/hbrr224/archive/2006/09/26/1287581.aspx

 

This topic describes the user-agent string, which identifies your browser and 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 Microsoft Internet Explorer, and documents registry keys that effect 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 you're visiting. This string indicates which browser you're 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 tailored for your specific browser.

Because certain third-parties add additional details to the user- agent string, it's 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 Web pages, your browser sends a number of headers to the server hosting the site you're visiting. Each header contains details that help the server determine the best way to provide the information you've requested. One header, called the user-agent, identifies the application requesting the information from the server. In addition, the user-agent string can contain optional details within parenthesis. Optional details are called tokens and vary between 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 and highlights its tokens.

A 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 specifically identifies the browser and contains the version number. The version token in the example ("MSIE 7.0") identifies Windows Internet Explorer 7.

  3. The Platform token ("Windows NT 6.0") identifies your operating system and contains its version number. The example token indicates Microsoft 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 World Wide Web link 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 of Internet Explorer, this provides details about your system.

Alternate tokens can appear in the user-agent string for a number of reasons; these usually identify optional features installed on your system. For example, an "SV1" token appears in the user- agent strings of Windows XP users who have installed Windows XP Service Pack 2 (SP2). It is also important to note that certain third-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's RFC 2616, Section 14: Header Field Definitions World Wide Web link.

Viewing the User-Agent String

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

javascript:alert(navigator.userAgent)

Please note that this is case-sensitive.

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

Viewingthe Internet Explorer user-agent string.

Tip  If you're using a recent version of Windows, you can copy your user-agent string to the Clipboard by pressing Ctrl+C before closing 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

The following table lists the version tokens used in recent versions of Internet Explorer. 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.

Version token Description
MSIE 7.0 Internet Explorer 7
MSIE 7.0b Internet Explorer 7 (Beta 1 pre-release only)
MSIE 6.0 Internet Explorer 6
MSIE 6.0b Internet Explorer 6 (pre-release)
MSIE 5.5 Internet Explorer 5.5
MSIE 5.01 Internet Explorer 5.01
MSIE 5.0 Internet Explorer 5
MSIE 5.0b1 Internet Explorer 5 (pre-release)
MSIE 4.01 Internet 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 token Description
Windows NT 6.0 Windows Vista
Windows NT 5.2 Windows Server 2003; Windows XP x64 Edition
Windows NT 5.1 Windows XP
Windows NT 5.01 Windows 2000, Service Pack 1 (SP1)
Windows NT 5.0 Windows 2000
Windows NT 4.0 Microsoft Windows NT 4.0
Windows 98; Win 9x 4.90 Windows Millennium Edition (Windows Me)
Windows 98 Windows 98
Windows 95 Windows 95
Windows CE Windows CE

Certain optional components can also modify the user-agent string; the following table shows common ones. Be aware that many third parties 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.

Token Description
.NET CLR .NET Framework common language runtime, followed by the version number
SV1 Internet Explorer 6 with enhanced security features. (Windows XP SP2 and Windows Server 2003 only)
Tablet PC Tablet services are installed; number indicates the version number
Win64; IA64 System has a 64-bit processor (Intel)
Win64; x64 System has a 64-bit processor (AMD)
WOW64 A 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 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 or Post Platform keys. The value's name should be the complete token; the value's 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 or Post Platform keys are displayed in an unpredictable order.

分享到:
评论

相关推荐

    可以用来更新IE全系UA的软件

    可以更改IE浏览器的UA,是通过调用API实现,所以可以实现全系UA的模拟。(不是通过修改注册表的方式实现的)

    一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10

    <meta http-equiv=X-UA-Compatible content=IE=EmulateIE7> 百度一下,你就知道 </title> <script>var wpo={start:new Date*1,pid:109,page:‘superpage’} <meta http-equiv=X-UA-Compatible content=IE=...

    IE 11自定义UA字符串方法.docx

    IE 11自定义UA字符串方法.docx

    content=”IE=7, IE=9″意思理解

    大致翻译是如果你有一个使用X-UA-Compatible Meta 标签或者http header 让网页在IE7标准模式解释的旧网站,那么这里有一个综合示例能够让ie8用ie7的标准模式呈现页面,ie9使用ie9的标准模式呈现页面。用自己的话就是...

    解决各种IE兼容问题_IE6_IE7_IE8_IE9_IE10

    metahttp-equiv=X-UA-Compatiblecontent=IE=EmulateIE7> 6 <title>百度一下,你就知道</title> 7 [removed]varwpo={start:newDate*1,pid:109,page:‘superpage’}[removed] <meta ...

    更改IE浏览器UA的插件

    ...UA测试网址 http://www.enhanceie.com/ua.aspx 使用过程中有什么问题联系 QQ:383572242 任意UA和Referer模拟技术 无论是http头还是本地js,均可达到完美欺骗效果 需求者联系QQ:383572242

    meta http-equiv=”X-UA-Compatible” content=”IE=7″ 意思是将IE8用IE7进行渲染

    X-UA-Compatible是针对ie8新加的一个设置,对于ie8之外的浏览器是不识别的,这个区别与content="IE=7"在无论页面是否包含<!DOCTYPE>指令,都像是使用了 Windows Internet Explorer 7的标准模式。而content="IE=...

    leadhelp Cpa工具,请杀毒

    leadhelp Cpa工具,请杀毒 换IE ua工具

    关于IE8兼容:X-UA-Compatible属性的解释

    meta http-equiv=”X-UA-Compatible” content=”IE=9; IE=8; IE=7; IE=EDGE” />1、这个到底是什么意思? 2、一些示例使用”,”分离IE的版本,而一些使用”;“,哪个正确? 3、我想知道IE=9; IE=8; IE=7; IE=...

    使用X-UA-Compatible来设置IE浏览器兼容模式

    为了帮助确保你的网页在所有未来的IE版本都有一致的外观,IE8引入了文件兼容性。在IE6中引入一个增设的兼容性模式,文件兼容性使你能够在IE呈现你的网页时选择特定编译模式。新的IE为了确保网页在未来的版本中都有一...

    JS 正则表达式判断各个浏览器代码详解

    注释都在代码里面了。很详细。 只判断了IE 火狐 谷歌 因为我没装其他浏览器了... //ie ua=mozilla/4.0 (compatible; msie 8.0; windows nt 5.2; trident/4.0; qqpinyin 730; .net clr 1.1.4322) //firefox ua=mozilla/5

    x-ua-compatible content=”IE=7, IE=9″意思理解

    meta http-equiv=”x-ua-compatible” content=”ie=7″ /> <![endif]–> <!–[if IE 9]> <meta http-equiv=”x-ua-compatible” content=”ie=9″ /> <![endif]–> 哎,苦逼啊。本以为搞定了IE6...

    IE8调用IE7渲染模式,网页高度根据内容高度显示

    使mainiframe的高度根据网页高度自定义,在IE7中可以使用,IE8中无法使用,只要在<head></head>之间加入<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />,IE8调用IE7的渲染模式,就可以使mainiframe...

    ua-compatible:在快速中间件中设置X-UA-Compatible标头

    兼容ua 在快速中间件中设置X-UA-Compatible标头。 强制IE使用最新的渲染引擎,如果已安装,默认为chrome-frame ... res.get('X-UA-Compatible') // === 'IE=edge,chrome=1' }) app.listen(3000) 学分

    简单实用的notie-js消息提示框插件.zip

    meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>简单实用的notie.js消息提示框插件</...

    一行代码解决各种IE兼容问题(IE6-IE10)

    x-ua-compatible 用来指定IE浏览器解析编译页面的model x-ua-compatible 头标签大小写不敏感,必须用在 head 中,必须在除 title 外的其他 meta 之前使用。 1、使用一行代码来指定浏览器使用特定的文档模式。 <...

    birt IE8-IE9兼容

    META HTTP-EQUIV="X-UA-Compatible" CONTENT="IE=EmulateIE7"> 2、 修改webcontent/birt/ajax/lib 文件下 /prototype.js 第564行 var Ajax={这行 交换加载顺序 代码如下: var Ajax = {getTransport: function() ...

    IE11兼容性问题完美解决(用户代理字符串)

    IE11兼容性问题完美解决(用户代理字符串),用于解决win8/win8.1下IE11的兼容性问题

    IE=edge,chrome=1的META信息详解

    meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″> 但令我好奇的是,此处这个标记后面竟然出现了chrome这样的值,难道IE也可以模拟chrome了? 迅速搜索了一下,才明白原来不是微软增强了IE,...

Global site tag (gtag.js) - Google Analytics