User-Agent header: Difference between revisions

From Wikipedia, the free encyclopedia
[pending revision][pending revision]
Content deleted Content added
JetarR (talk | contribs)
Undid revision 160284851 by Pathoschild (talk) the list is very helpful, the external links aren't
m restored edit (see http://www.user-agents.org/ in external links)
Line 1: Line 1:
{{cleanup-laundryrack}}
A '''user agent''' is the [[client (computing)|client]] application used with a particular [[network protocol]]; the phrase is most commonly used in reference to those which access the [[World Wide Web]], but other systems such as [[Session Initiation Protocol|SIP]] uses the term user agent to refer to the user's phone. Web user agents range from [[web browser]]s to [[search engine]] [[web crawler|crawler]]s ("spiders"), as well as [[mobile phone]]s, [[screen reader]]s and [[braille]] browsers used by people with disabilities.
A '''user agent''' is the [[client (computing)|client]] application used with a particular [[network protocol]]; the phrase is most commonly used in reference to those which access the [[World Wide Web]], but other systems such as [[Session Initiation Protocol|SIP]] uses the term user agent to refer to the user's phone. Web user agents range from [[web browser]]s to [[search engine]] [[web crawler|crawler]]s ("spiders"), as well as [[mobile phone]]s, [[screen reader]]s and [[braille]] browsers used by people with disabilities.
When Internet users visit a web site, a text [[string (computer science)|string]] is generally sent to identify the user agent to the [[web server|server]]. This forms part of the [[Hypertext Transfer Protocol|HTTP]] request, prefixed with '''User-agent:''' or '''User-Agent:''' and typically includes information such as the application name, version, host [[operating system]], and language. [[Internet bot|Bot]]s, such as web crawlers, often also include a [[Uniform Resource Locator|URL]] and/or [[e-mail address]] so that the [[webmaster]] can contact the operator of the bot.
When Internet users visit a web site, a text [[string (computer science)|string]] is generally sent to identify the user agent to the [[web server|server]]. This forms part of the [[Hypertext Transfer Protocol|HTTP]] request, prefixed with '''User-agent:''' or '''User-Agent:''' and typically includes information such as the application name, version, host [[operating system]], and language. [[Internet bot|Bot]]s, such as web crawlers, often also include a [[Uniform Resource Locator|URL]] and/or [[e-mail address]] so that the [[webmaster]] can contact the operator of the bot.
Line 27: Line 26:


There are a number of ways to perform user agent sniffing within web applications, including using public domain scripts and even commercial products such as BrowserHawk. See the External Links section for details.
There are a number of ways to perform user agent sniffing within web applications, including using public domain scripts and even commercial products such as BrowserHawk. See the External Links section for details.

== Some common user agent strings dissected ==

{{incomplete-list}}

=== Internet Explorer, and browsers cloaking as Internet Explorer ===

'''Mozilla/'''''MozVer'' '''(compatible; MSIE''' ''IEVer''[''';''' ''Provider'']''';''' ''Platform''[''';''' ''Extension'']*''')''' [''Addition'']

Where:
* ''MozVer'': Netscape compatibility version
** '''1.22''': Internet Explorer 1.5 and 2.0
** '''2.0''': Internet Explorer 3.x for Windows and Internet Explorer 2.1 for Mac
** '''3.0''': Internet Explorer 3.x for Mac
** '''4.0''': Internet Explorer 4.x and higher
* ''IEVer'': Internet Explorer version number, e.g.: '''1.5''', '''3.01''', '''5.0b1''', '''6.0'''
* ''Provider'': Access provider, e.g.:
** '''AOL''' ''Version''
** '''America Online Browser''' ''Version'''''; rev'''''Revision'': AOL Explorer (note, this breaks the rule of no semicolons in Provider values)
** '''CS 2000'''
** '''MSN''' ''Version''
** This parameter is included but empty on some Opera distributions, resulting in "semicolon space semicolon":
; ;
* ''Platform'': Operating system, e.g.:
** '''Windows 3.1''' (including Windows NT 3.x)
** '''Windows 95'''
** '''Windows 98'''
** '''Windows 98; Win 9x 4.90''': Windows Millennium Edition (Windows Me)
** '''Windows NT'''
** '''Windows NT 4.0'''
** '''Windows NT 5.0''': Windows 2000
** '''Windows 2000''': Windows 2000 (used by Opera)
** '''Windows NT 5.01''': Windows 2000, Service Pack 1 (SP1)
** '''Windows NT 5.1''': Windows XP
** '''Windows NT 5.2''': Windows Server 2003
** '''Windows NT 6.0''': Windows Vista
** '''Windows CE''': Windows CE and Windows Mobile (used by Internet Explorer Mobile)
** '''Win32''': Seen with IE 7b1 on Windows XP
** '''Mac_68000'''
** '''Mac_PPC''': Used up until IE 4.x
** '''Mac_PowerPC''': Used from IE 5.x and up
** '''SunOS''' ''Version'': SunOS
** '''Symbian OS''': Used by Opera on mobile phones
** '''Nitro''': Nintendo DS (used by Opera)
** '''PSP''': Playstation Portable
* ''Extension'': optional, a list of semicolon-separated extensions installed, e.g.:
** '''.NET CLR''' ''Version'': .NET Framework common language runtime installed (may appear multiple times, e.g. when both 1.1 and 2.0 are supported)
** '''SV1''': Internet Explorer 6 in [[Windows XP]] SP2 and [[Windows Server 2003]] SP1 installed
** '''Tablet PC''' ''Version'': Tablet services are installed
** '''Win64''': 64-bit Windows
** '''IA64''': Intel Itanium processor
** '''AMD64''': x64 processor
** '''x64''': x64 processor
** '''WOW64''': 32-bit Internet Explorer is running on 64-bit Windows
** '''Media Center PC''' ''Version'': Windows MCE, where ''Version'' is:
*** '''2.8''': Media Center 2004
*** '''3.0''': Media Center 2005
*** '''3.1''': Media Center 2005 with update rollup 1
*** '''4.0''': Media Center 2005 with update rollup 2
*** '''5.0''': Windows Vista Home Premium or Ultimate edition.
** '''MediaCenter''' ''Version'': browsing from within Media Center interface
** '''MSIECrawler''': MSIE retrieving pages for Offline Content feature
** '''X11''': Internet Explorer on SunOS
** '''PPC''': Pocket PC (used by Internet Explorer Mobile)
** '''Smartphone''': Smartphone (used by Internet Explorer Mobile)
** '''Motorola''' ''Type'': Internet Explorer Mobile on Motorola mobile phone
** '''Nokia''' ''Type'''''/'''''Version'': Opera on Nokia mobile phone
** Various 3rd party browser extensions, like: '''(R1''' ''Version''''')''' (RealPlayer webbrowser), '''Alexa Toolbar''', '''Maxthon''', '''Crazy Browser''' ''Version'', '''MyIE2''', '''Avant Browser [avantbrowser.com]''', '''FDM'''
** ''Language'': some Opera versions seem to include the language code here (seen for Opera 8.5 on Windows XP)
** ''Width'''''x'''''Height'': some Internet Explorer Mobile browsers include the display resolution here
* ''Addition''
** '''Netscape/'''''Version'': Netscape using MSHTML rendering engine
** '''Opera''' ''Version'' '''['''''Language''''']''': Opera cloaked as Internet Explorer

Example:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

==== Internet Explorer 1.0 ====

Internet Explorer 1.0 used an alternative user agent:
'''Microsoft Internet Explorer/'''''Version'' '''('''''Platform''''')'''

Where:
* ''Version'': Windows version because IE was originally supposed to be included with Windows 95, e.g.: '''4.0b1''' for Internet Explorer 1.0 beta
* ''Platform'': operating system, e.g.: '''Windows 95'''

=== Netscape ===

''This only applies to earlier versions of Netscape. Netscape 6.0 or higher based on the Gecko engine should see the Mozilla section below''

'''Mozilla/'''''Version''['''Gold'''] ['''['''''Language''''']'''][''Provider''] '''('''''Platform''''';''' ''Security''[''';''' ''SubPlatform''][''StandAlone'']''')'''

Where:
* ''Version'': version number
* '''Gold''': includes HTML editor
* ''Language'': standardized two-letter language identifier, e.g.: '''en''', '''fr''', '''es''' (Netscape 2.x and 3.x: only for non-English versions, Netscape 4.x: not on Macintosh platforms?)
* ''Provider'', may contain variants of '''C-CCK-MCD''' ([http://www.mozilla.org/projects/cck/history.html Client Customization Kit and Mission Control Desktop], for ISPs and OEMs)
* ''Platform''
** '''Win16''': Windows 3.x
** '''Win95''': Windows 95, where ''SubPlatform'' can be:
*** '''16bit''' for 16-bit version of Netscape
** '''Win98''': Windows 98
** '''WinNT''': Windows NT 3.x
** '''Windows NT 5.0''': Windows 2000
** '''Windows NT 5.1''': Windows XP
** '''X11''', where ''SubPlatform'' is:
*** ''Distribution'' ''Version'' [''Subversion''], e.g.: '''Linux i586''', '''SunOS 5.6 sun4u''', '''IRIX 6.5 IP32'''
** '''Macintosh''', where ''SubPlatform'' is:
*** '''[[68k|68K]]'''
*** '''[[PowerPC|PPC]]'''
*** '''[[x86 architecture|Intel]]'''
* ''Security''
** '''U''': strong security (USA)
** '''I''': weak security (International)
** '''N''': no security
* ''StandAlone'': standalone Navigator is indicated by '''; Nav''' (X11 platforms), ''';Nav''' (Windows, note missing space) or ''', Nav''' (on Macintosh), only for version 4.x

=== Mozilla ===

'''Mozilla/'''''MozVer'' '''('''''Platform''''';''' ''Security''''';''' ''SubPlatform''''';''' ''Language'''''; rv:'''''Revision''[''';''' ''Extension'']*''') Gecko/'''''GeckVer'' [''Product'''''/'''''ProdVer'']

Where:
* ''MozVer'': Netscape compatibility version
** '''5.0''' for all known Mozilla browsers
* ''Platform'' and ''SubPlatform''
** '''Windows'''
*** '''Win3.11''': Windows 3.11
*** '''Win95''': Windows 95
*** '''Win98''': Windows 98
*** '''Win 9x 4.90''': Windows Me
*** '''WinNT3.51''': Windows NT 3.51
*** '''WinNT4.0''': Windows NT 4.0
*** '''Windows NT 5.0''': Windows 2000
*** '''Windows NT 5.1''': Windows XP (except XP Professional x64 Edition)
*** '''Windows NT 5.2''': Windows Server 2003 and Windows XP Professional x64 Edition
*** '''Windows NT 6.0''': Windows Vista
*** '''Windows CE 4.21''': Windows Mobile 2003
** '''Macintosh'''
*** '''PPC Mac OS X'''
*** '''PPC Mac OS X Mach-O'''
*** '''Intel Mac OS X'''
** '''X11'''
*** '''Linux''' [''Version''] ''Hardware''
*** '''FreeBSD''' ''Hardware''
*** '''NetBSD''' ''Hardware''
*** '''OpenBSD''' ''Hardware''
*** '''SunOS''' ''Hardware''
** '''BeOS'''
*** '''BeOS BePC'''
* ''Security''
** '''U''': strong security (USA)
** '''I''': weak security (International)
** '''N''': no security
* ''Language'': standardized language identifier, e.g.: '''en''', '''en-US''', '''en-GB'''
* ''Revision'': e.g. '''m18''', '''1.0rc3''', '''1.7.8''', '''1.8a2'''
* ''Extension''
** '''MultiZilla''' ''Version''
* ''GeckVer'': Gecko (layout engine) compilation date, in the format ''YYYYMMDD''
* ''Product''
** For the Mozilla Application Suite, there is no Product or ProdVer. The Revision is the product version.
** '''Netscape''', '''Netscape6'''
** '''Phoenix''', '''Firebird''', '''Firefox''', '''GranParadiso''' (Firefox 3 codename), '''Minefield''' (trunk build)
** '''K-Meleon'''
** '''Minimo'''
** '''SeaMonkey'''
** '''Camino'''
** '''CS 2000 7.0'''
* ''ProdVer'': Product version

=== Konqueror ===

Any parts in square brackets can be omitted at the discretion of the user. In addition, Konqueror can fake its user agent if necessary.

Mozilla/''MozVer'' (compatible; Konqueror/''KonqVer''; [''OS'' ''OSVer'';] [''Platform'';] [''Arch'';] [''Lang'']) KHTML/''KVer'' (like Gecko)

* ''MozVer'': [[Mozilla]] compatibility version
** '''5.0''' for Konqueror 3.5.x
* ''KonqVer'': First two numbers of Konqueror version (e.g. 3.5)
* ''OS'': [[Operating system]] (for example '''Linux''')
* ''OSVer'': Operating system version
** On Linux this is equal to the output of <code>[[uname]] -r</code> (e.g. 2.6.22.2-42.fc6)
* ''Platform'': Platform/Window manager; for 3.x and earlier only '''X11''' is supported
* ''Arch'': [[CPU]] architecture
** '''i686'''
* ''Lang'': two-letter language specification, followed by an underscore and language variant, if any: for example, '''en_GB'''
* ''KVer'': [[KHTML]] version (the same as the Konqueror version); unlike ''KonqVer'' this includes all three numbers (e.g. 3.5.7)

=== PlayStation Portable ===

The PlayStation Portable has its own browser and User Agent:
Mozilla/4.0 (PSP (PlayStation Portable); 2.00)
The 2.00 means actually the [[firmware]] version, but Sony has never updated it. When the Internet browser published changed to firmware 2.00, it was not changed.

=== PlayStation 3 ===

the PlayStation 3 has its own browser and User Agent:
Mozilla/5.0 (PLAYSTATION 3; ''SysVer'')

*''SysVer'': The PS3 System Software Version

=== Wii ===

Opera/9.10 (Wii; U; ; 1621; en)

'''Opera/'''''ProdVer'' '''(Wii;''' ''Security''''';''' ''???''''';''' ''???''''';''' ''Language''''')'''

=== [[Nintendo DS Browser]] ===

Mozilla/4.0 (compatible; MSIE 6.0; Nitro) Opera 8.5


== Encryption strength "U" / "I" / "N" ==
== Encryption strength "U" / "I" / "N" ==

[[Netscape Navigator|Netscape]], [[Mozilla]], [[Opera (web browser)|Opera]] and some others use one of these three letters to specify the browser's [[encryption]] strength. Since the US government formerly would not allow encryption higher than 40-bit to be exported from the USA, different versions were released 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), "N" stands for "None" (no encryption). Originally the "U" version was allowed for download only from the USA, but since then the US government has loosened its policy and exporting high encryption is now permitted to most countries (see ''[[Export of cryptography]]'' for more information). Now [[Netscape Communications Corporation|Netscape]] and [[Mozilla Foundation|Mozilla]] distribute their browsers only in a "U" version, supporting up to 256-bit encryption, since an international version is no longer required.
[[Netscape Navigator|Netscape]], [[Mozilla]], [[Opera (web browser)|Opera]] and some others use one of these three letters to specify the browser's [[encryption]] strength. Since the US government formerly would not allow encryption higher than 40-bit to be exported from the USA, different versions were released 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), "N" stands for "None" (no encryption). Originally the "U" version was allowed for download only from the USA, but since then the US government has loosened its policy and exporting high encryption is now permitted to most countries (see ''[[Export of cryptography]]'' for more information). Now [[Netscape Communications Corporation|Netscape]] and [[Mozilla Foundation|Mozilla]] distribute their browsers only in a "U" version, supporting up to 256-bit encryption, since an international version is no longer required.



Revision as of 15:34, 26 September 2007

A user agent is the client application used with a particular network protocol; the phrase is most commonly used in reference to those which access the World Wide Web, but other systems such as SIP uses the term user agent to refer to the user's phone. Web user agents range from web browsers to search engine crawlers ("spiders"), as well as mobile phones, screen readers and braille browsers used by people with disabilities. When Internet users visit a web site, a text string is generally sent to identify the user agent to the server. This forms part of the HTTP request, prefixed with User-agent: or User-Agent: and typically includes information such as the application name, version, host operating system, and language. 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.

The user-agent string is one of the criteria by which crawlers can be excluded from certain pages or parts of a website using the "Robots Exclusion Standard" (robots.txt). This allows webmasters who feel that certain parts of their website should not be included in the data gathered by a particular crawler, or that a particular crawler is using up too much bandwidth, to request that crawler not to visit those pages.

User agent spoofing

At various points in its history, use of the Web has been dominated by one browser to the extent that many websites are designed to work with that particular browser, rather than according to standards from bodies such as the W3C and IETF. Such sites often include "browser sniffing" code, which alters the information sent out depending on the User-Agent string received. This can 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. Thus various browsers "cloak" or "spoof" this string, in order to identify themselves as something else to such detection code; often, the browser's real identity is then included later in the string.

The earliest example of this is Internet Explorer's use of a User-Agent string beginning "Mozilla/<version> (compatible; MSIE <version>...", in order to receive content intended for Netscape Navigator, its main rival at the time of its development. It should be stressed that this is not a reference to the open-source Mozilla browser, which was developed much later, but to the original codename for Navigator, which was also the name of the Netscape company mascot. This format of User-Agent string has since been copied by other user agents, partly because Explorer, in turn, came to dominate.

When Internet Explorer became the dominant web browser, rivals such as Firefox, Safari, and Opera implemented systems whereby the user could select a false User-Agent string to send, such as that of a recent version of Explorer. Some – e.g. Firefox and Safari – duplicate the User-Agent string they are trying to spoof exactly; others – e.g. Opera – duplicate the User-Agent string but add the genuine browser name to the end. This latter approach, of course, leads to a string containing three names and versions: first, the user agent claims to be "Mozilla" (i.e. Netscape Navigator); then, "MSIE" (Internet Explorer); and finally, the actual browser, such as "Opera". Opera also offers a full masking as Internet Explorer or Firefox, which hides "Opera" completely.

Beside browsers, other programs utilizing HTTP protocol, like most download managers and offline browsers, also had the ability to change the user agent string sent to servers to user's liking. This is presumably done in an effort to maintain compatibility with certain servers (some servers refused to serve those programs right away because they are mostly used carelessly, thus burdening the server).

This vicious circle is expected to continue in the area of web browsers. Some standards-based web developers have started the "Viewable With Any Browser" campaign which encourages developers to design webpages according to official standards, not for any particular browser(s).

As of 2005, many websites are more standards-compliant than at other times in the history of the web. However, out-dated JavaScript, which effectively locks out browsers other than Explorer or Navigator, is still in use on many websites.[original research?] This is often blamed on use of cargo cult programming, in the form of copying and pasting older code without actually understanding what effect this will have on the website.

One result of user agent spoofing is that the usage share of Internet Explorer, the user agent browsers typically spoof, is probably overestimated, and the usage share of other browsers may be underestimated. User agent spoofing can also provide a security issue by spoofing search engine bots and bypassing key parts in a website.

User agent sniffing

The term user agent sniffing refers to websites that show 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 (e.g. Microsoft Internet Explorer). An infamous example of this is Microsoft's Outlook 2003 Web Access. When viewed with IE, much more functionality is displayed compared to the same page in any other browser. User agent sniffing is mostly considered poor practice for Web 2.0 web sites, since it encourages browser specific design. Many webmasters are recommended to create an HTML markup that is as standardised as possible, to allow correct rendering in as many browsers as possible.

Websites 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 browsers on mobile phones often differ a lot from each other. Many developments in mobile browsing have been made in the last few years, while many older phones that do not possess these new technologies are still heavily used. Therefore, mobile webportals 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).

There are a number of ways to perform user agent sniffing within web applications, including using public domain scripts and even commercial products such as BrowserHawk. See the External Links section for details.

Encryption strength "U" / "I" / "N"

Netscape, Mozilla, Opera and some others use one of these three letters to specify the browser's encryption strength. Since the US government formerly would not allow encryption higher than 40-bit to be exported from the USA, different versions were released 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), "N" stands for "None" (no encryption). Originally the "U" version was allowed for download only from the USA, but since then the US government has loosened its policy and exporting high encryption is now permitted to most countries (see Export of cryptography for more information). Now Netscape and Mozilla distribute their browsers only in a "U" version, supporting up to 256-bit encryption, since an international version is no longer required.

See also

External links