• December 21, 2024

User Agent

User-Agent – HTTP – MDN Web Docs

SyntaxUser-Agent: /
Common format for web browsers:
User-Agent: Mozilla/5. 0 () ()
Directives A product identifier — its name or development codename. Version number of the product.

Zero or more comments containing more details. For example, sub-product information.
Firefox UA stringFor more on Firefox- and Gecko-based user agent strings, see the Firefox user agent string reference. The UA string of Firefox is broken down into 4 components:
Mozilla/5. 0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion
Mozilla/5. 0 is the general token that says that the browser is Mozilla-compatible. For historical reasons, almost every browser today sends it.
platform describes the native platform that the browser is running on (Windows, Mac, Linux, Android, etc. ) and if it is a mobile phone. Firefox OS phones say Mobile — the web is the platform. Note that platform can consist of multiple “;”-separated tokens. See below for further details and examples.
rv:geckoversion indicates the release version of Gecko (such as “17. 0”). In recent browsers, geckoversion is the same as firefoxversion.
Gecko/geckotrail indicates that the browser is based on Gecko. (On the desktop, geckotrail is always the fixed string 20100101. )
Firefox/firefoxversion indicates that the browser is Firefox and provides the version (such as “17. 0”).
ExamplesMozilla/5. 0 (Windows NT 6. 1; Win64; x64; rv:47. 0) Gecko/20100101 Firefox/47. 0
Mozilla/5. 0 (Macintosh; Intel Mac OS X x. y; rv:42. 0) Gecko/20100101 Firefox/42. 0
Chrome UA stringThe Chrome (or Chromium/Blink-based engines) user agent string is similar to Firefox’s. For compatibility, it adds strings like KHTML, like Gecko and Safari. ExamplesMozilla/5. 0 (X11; Linux x86_64) AppleWebKit/537. 36 (KHTML, like Gecko) Chrome/51. 0. 2704. 103 Safari/537. 36
Opera UA stringThe Opera browser is also based on the Blink engine, which is why it almost looks the same as the Chrome UA string, but adds “OPR/“. 106 Safari/537. 36 OPR/38. 2220. 41
Older, Presto-based Opera releases used:
Opera/9. 80 (Macintosh; Intel Mac OS X; U; en) Presto/2. 2. 15 Version/10. 00
Opera/9. 60 (Windows NT 6. 0; U; en) Presto/2. 1. 1
Microsoft Edge UA stringThe Edge browser is also based on the Blink engine. It adds “Edg/“. 0 (Windows NT 10. 0; Win64; x64) AppleWebKit/537. 36 (KHTML, like Gecko) Chrome/91. 4472. 124 Safari/537. 36 Edg/91. 864. 59
Safari UA stringIn this example, the user agent string is mobile Safari’s version. It contains the word “Mobile”. 0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605. 15 (KHTML, like Gecko) Version/13. 1 Mobile/15E148 Safari/604. 1
Internet Explorer UA stringExamplesMozilla/5. 0 (compatible; MSIE 9. 0; Windows Phone OS 7. 5; Trident/5. 0; IEMobile/9. 0)
Crawler and bot UA stringsExamplesMozilla/5. 0 (compatible; Googlebot/2. 1; +)
Mozilla/5. 0 (compatible; YandexAccessibilityBot/3. 0; +)
Examplescurl/7. 64. 1
PostmanRuntime/7. 26. 5
SpecificationsSpecificationHypertext Transfer Protocol (HTTP/1. 1): Semantics and Content (HTTP/1. 1)# compatibilityBCD tables only load in the browserSee also
User-Agent detection, history and checklist
Firefox user agent string reference
Browser detection using the user agent
User agent - Wikipedia

User agent – Wikipedia

In computing, a user agent is any software, acting on behalf of a user, which “retrieves, renders and facilitates end-user interaction with Web content”. [1] A user agent is therefore a special kind of software agent.
Some prominent examples of user agents are web browsers and email readers. Often, a user agent acts as the client in a client–server system. In some contexts, such as within the Session Initiation Protocol (SIP), the term user agent refers to both end points of a communications session. [2]
User agent identification[edit]
When a 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, [3] SIP, [2] and NNTP[4] 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.
Use in HTTP[edit]
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 concept of content tailoring is built into the HTTP standard in RFC 1945 “for the sake of tailoring responses to avoid particular user agent limitations”.
The User-Agent string is one of the criteria by which Web crawlers may be excluded from accessing certain parts of a website using the Robots Exclusion Standard ( file).
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. [5]
Format for human-operated web browsers[edit]
The User-Agent string format is currently specified by section 5. 5. 3 of HTTP/1. 1 Semantics and Content. The format of the User-Agent string in HTTP is a list of product tokens (keywords) with optional comments. For example, if a user’s product were called WikiBrowser, their 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)
During the first browser war, many web servers were configured to send web pages that required advanced features, including frames, to clients that were identified as some version of Mozilla only. [6] Other browsers were considered to be older products such as Mosaic, Cello, or Samba, and would be sent a bare bones HTML document.
For this reason, most Web browsers use a User-Agent string 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. 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.
Before migrating to the Chromium code base, Opera was the most widely used web browser that did not have the User-Agent string with “Mozilla” (instead beginning it with “Opera”). Since July 15, 2013, [7] Opera’s User-Agent string begins with “Mozilla/5. 0” and, to avoid encountering legacy server rules, no longer includes the word “Opera” (instead using the string “OPR” to denote the Opera version).
Format for automated agents (bots)[edit]
Automated web crawling tools can use a simplified form, where an important field is contact information in case of problems. By convention the word “bot” is included in the name of the agent. [8] For example:
Googlebot/2. 1 (+)
Automated agents are expected to follow rules in a special file called “”.
User agent spoofing[edit]
The popularity of various Web browser products has varied throughout the Web’s history, and this has influenced the design of websites in such a way that websites 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). Websites 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. [9] 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 (among other things) in order to aid compatibility. [10][11]
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.
A result of user agent spoofing may be that collected statistics of Web browser usage are inaccurate.
User agent sniffing[edit]
User agent sniffing is the practice of websites showing different or adjusted content when viewed with certain user agents. An 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 other browsers. User agent sniffing is considered poor practice, since it encourages browser-specific design and penalizes new browsers with unrecognized user agent identifications. Instead, the W3C recommends creating standard HTML markup, [12] allowing correct rendering in as many browsers as possible, and to test for specific browser features rather than particular browser versions or brands. [13]
Websites intended for display by mobile phones often rely on user agent sniffing, since mobile browsers often differ greatly from each other.
Encryption strength notations[edit]
Web browsers created in the United States, such as Netscape Navigator and Internet Explorer, previously used 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). [14] Following the lifting of export restrictions, most vendors supported 256-bit encryption.
[edit]
In 2020, Google announced that they would be phasing out support for the User-Agent header in their Google Chrome browser. They stated that other major web browser vendors were supportive of the move, but that they did not know when other vendors would follow suit. [15] Google stated that a new feature called Client Hints would replace the functionality of the User-Agent string. [16]
See also[edit]
Robots exclusion standard
Web crawler
Wireless Universal Resource File (WURFL)
User Agent Profile (UAProf)
Browser sniffing
Web browser engine
References[edit]
^ “W3C Definition of User Agent”.. 16 June 2011. Retrieved 2018-10-20.
^ a b RFC 3261, SIP: Session Initiation Protocol, IETF, The Internet Society (2002)
^ RFC 7231, Hypertext Transfer Protocol (HTTP/1. 1): Semantics and Content, IETF, The Internet Society (June 2014)
^ Netnews Article Format. IETF. November 2009. sec. 3. 2. 13. doi:10. 17487/RFC5536. RFC 5536.
^ Eckersley, Peter (27 January 2010). “Browser Versions Carry 10. 5 Bits of Identifying Information on Average”. Electronic Frontier Foundation. Retrieved 25 August 2011.
^ History of the browser user-agent string. WebAIM.
^ “Opera User Agent Strings: Opera 15 and Beyond”. 15 July 2013. Retrieved 2014-05-05.
^ ”
^ Burstein complaining “… I’ve been rejected until I come back with Netscape”
^ “Android Browser Reports Itself as Apple Safari”. Archived from the original on August 6, 2011. Retrieved August 9, 2011.
^ “User Agent String explained: Android Webkit Browser”. Retrieved 29 July 2012. Mozilla/5. 0 (Linux; U; Android 2. 2; en-sa; HTC_DesireHD_A9191 Build/FRF91) AppleWebKit/533. 1 (KHTML, like Gecko) Version/4. 0 Mobile Safari/533. 1
^ Pemberton, Stephen. “W3C Markup Validation Service”. W3C. Retrieved 2011-10-18.
^ Clary, Bob (10 February 2003). “Browser Detection and Cross Browser Support”. Mozilla Developer Center. Mozilla. Retrieved 2009-05-30.
^ Zawinski, Jamie (28 March 1998). “user-agent strings (obsolete)”. Retrieved 2010-01-08.
^ “Chrome Phasing out Support for User Agent”. InfoQ. Retrieved 2020-03-25.
^ Cimpanu, Catalin. “Google to phase out user-agent strings in Chrome”. ZDNet. Retrieved 2020-03-25.
Definition of User Agent - WAI UA Wiki - W3C

Definition of User Agent – WAI UA Wiki – W3C

Definition: A user agent is any software that retrieves, renders and facilitates
end user interaction with Web content, or whose user interface is
implemented using Web technologies. {revised from)
Introduction in Guidelines
revisions and additions to A user agent is any software that retrieves and presents Web content for end users or is implemented using Web technologies. User agents include Web browsers, media players, and plug-ins that help in retrieving, rendering and interacting with Web content. The family of user agents also includes operating system shells, consumer electronics with Web-widgets, and stand-alone applications or embedded applications whose user interface is implemented as a combination of Web technologies.
comment: greg – I suggest having at least a user-friendly paragraph in the intro that explicitly refers readers to the glossary for a formal, normative definition.
While rendering engines and other technologies used to build user agents are not by themselves considered user agents, it is fundamental to user agent accessibility that these technologies support user agent requirements. In building a user agent the developer should fully understand the support for UAAG 2. 0 when selecting technologies.
What qualifies as a User Agent?
The following tests can be used to determine if software qualifies as a user agent for the purposes of these guidelines. It divides potential user agents into Primary Agents (the traditional “browser”), Extensions and Plug-ins, and Web-based User Agents.
If the following three conditions are met then it is a Primary User Agent and Must Conform to UAAG:
If it is a standalone application; and
If it interprets any w3c specified language; and
If it provides a user interface or interprets either a procedural or declarative language that may be used to provide a user interface.
If the following two conditions are met then it is a User Agent Extension or Plug-In and Must Conform to UAAG:
If it is launched by, or extends the functionality of, a Primary User Agent; and
If post-launch user interaction either becomes part of, or is within the bounds of, the Primary User Agent.
If the following three conditions are met then it is a Web-Based User Agent and Must Conform to UAAG:
If the user interface is generated by the interpretation of either a procedural or declarative language; and
If this interpretation is by a Primary User Agent, User Agent Extension or Plug-In; and
If user interaction is not passed to and from the Primary User Agent, User Agent Extension or Plug-In, or if user interaction does not modify the Document Object Model of its containing document.

Frequently Asked Questions about user agent

What is the role of user agent?

A user agent is any software that retrieves and presents Web content for end users or is implemented using Web technologies. User agents include Web browsers, media players, and plug-ins that help in retrieving, rendering and interacting with Web content.

How do I use user agent?

Select the “Advanced” tab and enable the “Show Develop menu in menu bar” option at the bottom of the window. Click Develop > User Agent and select the user agent you want to use in the list. If the user agent you want to use isn’t shown here, select “Other” and you can provide a custom user agent.Jul 3, 2017

What is an example of a user agent?

Browsers like Mozilla Firefox, Google’s Chrome as well as Safari and Opera are examples of user agents. However, other applications can also act as user agents. Examples are: Crawlers: Googlebot, Yahoo!

Leave a Reply