`
dxm1986
  • 浏览: 435019 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

User agent

 
阅读更多

http://en.wikipedia.org/wiki/User_agent

User agent

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computing, a user agent is software (a software agent) that is acting on behalf of a user. For example, an email reader is a Mail User Agent, and in the Session Initiation Protocol (SIP), the term user agent refers to both end points of a communications session.[1]

In many cases, a user agent acts as a client in a network protocol used in communications within a client–server distributed computing system. In particular, the Hypertext Transfer Protocol identifies the client software originating the request, using a "User-Agent" header, even when the client is not operated by a user. The SIP protocol (based on HTTP) followed this usage.

Contents

 [hide

[edit] User-agent identification

When software agent operates in a network protocol, it often identifies itself, its application type, operating system, software vendor, or software revision, by submitting a characteristic identification string to its operating peer. In HTTP, SIP, and SMTP/NNTP[2] protocols, this identification is transmitted in a header field User-Agent. Bots, such as Web crawlers, often also include a URL and/or e-mail address so that the Webmaster can contact the operator of the bot.

In HTTP, the User-Agent string is often used for content negotiation, where the origin server selects suitable content or operating parameters for the response. For example, the User-Agent string might be used by a web server to choose variants based on the known capabilities of a particular version of client software.

The User-Agent string is one of the criteria by which Web crawlers may be excluded from accessing certain parts of a Web site using the Robots Exclusion Standard (robots.txt file).

[edit] Possible privacy issue

As with many other HTTP request headers, the information in the "User-Agent" string contributes to the information that the client sends to the server, since the string can vary considerably from user to user.[3]

[edit] Format

The User-Agent string format is currently specified by Section 14.43 of RFC 2616 (HTTP/1.1) The format of the User-Agent string in HTTP is a list of product tokens (keywords) with optional comments. For example if your product were called WikiBrowser, your user agent string might be WikiBrowser/1.0 Gecko/1.0. The "most important" product component is listed first. The parts of this string are as follows:

  • Product name and version (WikiBrowser/1.0)
  • Layout engine and version(Gecko/1.0). In this case, this indicates the Layout engine and version.

Unfortunately, during the browser wars, many web servers were configured to only send web pages that required advanced features to clients that were identified as some version of Mozilla.

For this reason, most Web browsers use a User-Agent value as follows: Mozilla/[version] ([system and browser information]) [platform] ([platform details]) [extensions]. For example, Safari on the iPad has used the following:

 Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405

The components of this string are as follows:

  • Mozilla/5.0: Previously used to indicate compatibility with the Mozilla rendering engine
  • (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us): Details of the system in which the browser is running
  • AppleWebKit/531.21.10: The platform the browser uses
  • (KHTML, like Gecko): Browser platform details
  • Mobile/7B405: This is used by the browser to indicate specific enhancements that are available directly in the browser or through third parties. An example of this is Microsoft Live Meeting which registers an extension so that the Live Meeting service knows if the software is already installed, which means it can provide a streamlined experience to joining meetings.

[edit] User agent spoofing

The popularity of various Web browser products has varied throughout the Web's history, and this has influenced the design of Web sites in such a way that Web sites are sometimes designed to work well only with particular browsers, rather than according to uniform standards by the World Wide Web Consortium (W3C) or the Internet Engineering Task Force (IETF). Web sites often include code to detect browser version to adjust the page design sent according to the user agent string received. This may mean that less-popular browsers are not sent complex content (even though they might be able to deal with it correctly) or, in extreme cases, refused all content.[4] Thus, various browsers have a feature to cloak or spoof their identification to force certain server-side content. For example, the Android browser identifies itself as Safari in order to aid compatibility.[5]

Other HTTP client programs, like download managers and offline browsers, often have the ability to change the user agent string.

Spam bots and Web scrapers often use fake user agents.

At times it has been popular among Web developers to initiate Viewable With Any Browser campaigns,[6] encouraging developers to design Web pages that work equally well with any browser.

A result of user agent spoofing may be that collected statistics of Web browser usage are inaccurate.

[edit] User agent sniffing

The term user agent sniffing refers to the practice of Web sites showing different content when viewed with a certain user agent. On the Internet, this will result in a different site being shown when browsing the page with a specific browser. A useful example of this is Microsoft Exchange Server 2003's Outlook Web Access feature. When viewed with Internet Explorer 6 (or newer), more functionality is displayed compared to the same page in any older browsers, because older browsers could not render the same content.[citation needed] User agent sniffing is mostly considered poor practice, since it encourages browser-specific design and penalizes new browsers with unrecognized user agent identifications. Instead, the W3C recommends creating HTML markup that is standard,[7] allowing correct rendering in as many browsers as possible, and to test for specific browser features rather than particular browser versions or brands.[8]

Web sites specifically targeted towards mobile phones, like NTT DoCoMo's I-Mode or Vodafone's Vodafone Live! portals, often rely heavily on user agent sniffing, since mobile browsers often differ greatly from each other. Many developments in mobile browsing have been made in the last few years,[when?] while many older phones that do not possess these new technologies are still heavily used. Therefore, mobile Web portals will often generate completely different markup code depending on the mobile phone used to browse them. These differences can be small, e.g., resizing of certain images to fit smaller screens, or quite extensive, e.g., rendering of the page in WML instead of XHTML.

[edit] Encryption strength notations

Web browsers created in the United States, such as Netscape Navigator and Internet Explorer, use the letters U, I, and N to specify the encryption strength in the user agent string. Until 1996, when the United States government allowed encryption with keys longer than 40 bits to be exported, vendors shipped various browser versions with different encryption strengths. "U" stands for "USA" (for the version with 128-bit encryption), "I" stands for "International" — the browser has 40-bit encryption and can be used anywhere in the world — and "N" stands (de facto) for "None" (no encryption).[9] Following the lifting of export restrictions, most vendors supported 256-bit encryption.

[edit] See also

[edit] References

  1. ^ RFC 3261, SIP: Session Initiation Protocol, IETF, The Internet Society (2002)
  2. ^ Netnews Article Format. IETF. November 2009. sec. 3.2.13. RFC 5536.
  3. ^ Peter Eckersley. "Browser Versions Carry 10.5 Bits of Identifying Information on Average", Electronic Frontier Foundation, 27 January 2010. Retrieved 25 August 2011.
  4. ^ Burstein complaining "... I've been rejected until I come back with Netscape"
  5. ^ http://androidcommunity.com/forums/f8/android-browser-reports-itself-as-apple-safari-4701/
  6. ^ "Viewable with Any Browser" campaign
  7. ^ Pemberton, Stephen. "W3C Markup Validation Service". W3C. Retrieved 2011-10-18.
  8. ^ Clary, Bob (10 February 2003). "Browser Detection and Cross Browser Support". Mozilla Developer Center. Mozilla. Retrieved 2009-05-30.
  9. ^ Zawinski, Jamie (1998-03-28). "user-agent strings (obsolete)". mozilla.org. Retrieved 2010-01-08.
分享到:
评论

相关推荐

    Import list of user agent swicher

    还在为 user agent swicher 只有IPHONE、IE、search robot这三种烦恼吗? 导入这个列表吧,包括了目前主流的浏览器标识 使用方法 先安装好,重启火狐浏览器之后,打开菜单栏“工具”“Dafault User Agent”“Edit ...

    对User Agent的检测与模拟

    5. **`useragentswitcher.xml`**: - 这个文件可能是某种工具(如浏览器插件)的配置文件,用于存储多种预定义的User Agent字符串。 - 用户可以通过切换不同的User Agent设置,方便地在多种身份间切换,适用于测试...

    user agent switcher手机UA模拟器列表

    user agent switcher是火狐手机ua模拟组件,这个包含了user agent switcher的ua列表和上万种手机UA列表,您可以自己动手书写自己先要的模拟的ua信息。user agent switcher很不错,希望能给大家带来帮助!

    【Python源码】python-user-agents:浏览器 user agent 解析器

    python源码 - python-user-agents:浏览器 user agent 解析器 user_agents是一个 Python 库,它提供了一种通过解析 (浏览器/HTTP) 用户代理字符串来识别/检测手机、平板电脑等设备及其功能的简单方法。目标是...

    浏览器UA切换 User Agent Switcher xml

    浏览器UA切换 UserAgent UserAgentSwitcher.xml

    user Agent Switcher

    可用firefox导入 导入之后就可以在浏览器中切换user Agent

    useragentswitcher

     重启”Mozilla Firefox“,在Mozilla Firefox顶部的菜单上按右键,选“定制(C)..."->找到一个黑白的地球图标下面写着"User Agent"->把它拖拽到Mozilla Firefox顶部的菜单上->"完成"   [网络传输]手机+蓝牙+CMWAP...

    CPALEAD自动填表工具 支持 user agent伪造

    3. **绕过限制**:有些网站会针对特定User Agent实施访问限制,伪造User Agent可以规避这些限制。 4. **优化抓取**:在网络爬虫中,改变User Agent可以防止被目标网站识别为机器人并被封锁。 在给定的文件列表中,...

    Import list of user agent swicher 2014-02-15 更新

    useragentswicher 更新至2014-02-15日为止... 导入这个列表吧,包括了目前主流的浏览器标识 使用方法 先安装好,重启火狐浏览器之后,打开菜单栏“工具”“Dafault User Agent”“Edit User Agents”“Import…”导入

    10000个移动User Agent(UA库)

    移动User Agent,通常简称为UA(User Agent),是网络浏览器发送到服务器的一个字符串,用于标识访问者所使用的设备、操作系统、浏览器类型及版本等信息。这个字符串对于网站开发者和服务提供商至关重要,因为它允许...

    User-Agent Switcher for Chrome 汉化版

    **User-Agent Switcher for Chrome 汉化版**是一款针对谷歌浏览器(Chrome)设计的扩展程序,它允许用户轻松地更改浏览器发送的User-Agent字符串,从而模拟不同设备或浏览器环境来访问网页。这个功能在进行网页开发...

    chrome-user-agent.crx

    Android等等做测试,就可以试试user agent,这套 Chrome浏览器的扩展程序,能将Chrome伪装成各大家不同的浏览器,让你方便测试初始网页。user agent扩展可以轻松,快捷地修改Chrome浏览器的UA。 支持自动切换模式,...

    修改了UA(user agent 用户代理) opera简体中文版本V8.54的dll文件

    我还同时提供了一个修改了UA(user agent 用户代理) 的dll文件,再下载并解压后,在C盘 program files 下面的opera文件夹下替换同名文件即可。 注意,启动opera之后,要点击F12键盘,把最下面的识别为internet exploer6...

    根据User Agent String判断客户端平台及浏览器源程序[Java和PHP版]

    User Agent String(简称UA字符串)就是一个关键工具,它包含了客户端浏览器的详细信息,如浏览器名称、版本、操作系统等。本资源提供了基于Java和PHP的解决方案,帮助开发者解析和识别UA字符串,从而判断客户端平台...

    JavaUser-Agent解析库

    User-Agent字符串包含了访问网站的客户端信息,如浏览器类型、版本、操作系统等。在Java开发中,有一个名为`User-Agent Utilities`的库,由Harald Walker开发,其版本号可能为2a6db83,这正是我们要讨论的焦点。 这...

    浏览器默认样式(User Agent Stylesheet)的介绍与最佳处理方法

    浏览器默认样式(User Agent Stylesheet)是指浏览器为了呈现基本的网页结构和内容,预先定义的一系列CSS样式。每个浏览器都有自己的User Agent Stylesheet,用于确保基本的HTML元素在没有明确的CSS定义时,能够以一种...

    【浏览器插件】User-Agent Switcher.zip

    【浏览器插件-User-Agent Switcher】User Agent Switcher 是一款简洁而高效的浏览器扩展工具。它不受你使用的浏览器或操作系统的限制,让你的网络体验更加流畅。该扩展通过添加一个工具栏按钮,让你能够轻松切换至...

Global site tag (gtag.js) - Google Analytics