{
  "id": "user-agent",
  "title": "User agent",
  "lang": "en",
  "source_lang": "en",
  "summary": "A user agent is software that acts on a user’s behalf when accessing network services, especially a web browser or other HTTP client.",
  "category": "computer-science",
  "subcategory": "software",
  "type": "concept",
  "aliases": [
    "UA"
  ],
  "generated_at": "2026-11-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/user-agent/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/user-agent/",
      "json": "https://aiwiki.page/zh/user-agent.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A user agent is software that acts on behalf of a user when interacting with a network service. On the World Wide Web, the term most commonly refers to a web browser, but it also includes command-line clients, automated crawlers, and other programs that retrieve or process web resources. In HTTP, a user agent is the client program that originates a request. The term also occurs in other systems, including email. A user agent is distinct from the User-Agent header, which is one mechanism through which software identifies itself to a server."
    },
    {
      "heading": "Role in network communication",
      "text": "In the client–server model, a user agent initiates an interaction to accomplish a task for its user: opening a document, submitting a form, downloading a file, or retrieving information automatically. The user need not directly initiate every request. A browser, for example, may make many additional requests for images, scripts, and stylesheets after a person opens a single page.\n\nFor web access, a user agent typically:\n\n- Identifies a resource through a URL.\n- Sends requests and interprets responses.\n- Processes the received content according to its supported formats.\n- Maintains relevant state, such as cookies and cached resources.\n- Applies security and privacy policies.\n- Presents results to a person or passes them to another program.\n\nA graphical browser can render HTML, apply CSS, and execute JavaScript. A simpler HTTP client might only download response data. Both can be user agents; displaying a graphical interface is not a requirement.\n\nHTTP distinguishes the originating user agent from intermediaries. A forward proxy relays requests for clients, while a gateway or reverse proxy generally presents a server-facing interface on behalf of other servers. Although an intermediary can act as an HTTP client on one connection, that does not make it the originating user agent for the overall request."
    },
    {
      "heading": "Types of user agents",
      "text": "Interactive web browsers\n\nDesktop and mobile browsers are the most familiar user agents. They combine network communication, document rendering, scripting, storage, and user-interface functions.\n\nBrowser behavior also affects accessibility. A browser can expose document structure and controls to assistive technologies such as a screen reader. In accessibility discussions, “user agent” can have a broader scope than an HTTP client, encompassing software that retrieves, renders, or facilitates interaction with web content.\n\nAutomated clients\n\nAutomated user agents include:\n\n- Web crawlers, which discover and retrieve pages for a search engine or another indexing system.\n- Command-line clients, which transfer resources in response to commands or scripts.\n- Monitoring tools, which check availability, response times, or expected content.\n- Application clients, which communicate with an API.\n- Browser automation tools, which control a browser for testing or other automated tasks.\n\nAutomation does not by itself distinguish a user agent from other software. The defining feature is its role in accessing a service on behalf of a user or operator.\n\nMail user agents\n\nA mail user agent is an application used to read, compose, send, and manage email. It differs from a mail transfer agent, which transports messages between mail systems, and from a mail delivery agent, which performs final delivery to a mailbox. These are functional distinctions: one software package may implement more than one role."
    },
    {
      "heading": "The HTTP User-Agent header",
      "text": "The User-Agent request header carries information about the software originating an HTTP request. Servers can use it for diagnostics, compatibility handling, and aggregate usage analysis.\n\nAn illustrative value is:\n\nUser-Agent: ExampleClient/2.4 (ExampleOS)\n\nHTTP defines its basic structure as one or more product identifiers, optionally accompanied by comments. A product identifier consists of a product name and an optional version. Real browser values often contain multiple identifiers and compatibility tokens rather than one unambiguous application name.\n\nThe field is not a standardized inventory of the device or its capabilities. Depending on the implementation, it may include or imply:\n\n- Browser or client family.\n- Software version.\n- Operating system family.\n- Device class, such as mobile or desktop.\n- Rendering-engine identifiers.\n- Historical compatibility markers.\n\nThese details are neither universally present nor necessarily accurate. HTTP semantics specify that a user agent should send the field unless it has been specifically configured not to do so, but servers must accommodate requests that omit it.\n\nAccess from scripts\n\nIn web browsers, JavaScript can usually read a user-agent string through navigator.userAgent. Browser-controlled restrictions prevent ordinary page scripts from freely setting certain request headers, including User-Agent, through standard web request APIs.\n\nThe value exposed to scripts and the identification sent over the network are implementation-controlled. Neither is a reliable statement of a device’s complete hardware or software configuration."
    },
    {
      "heading": "Historical development and compatibility",
      "text": "User-agent identifiers became important during the early development of the Web, when browsers differed substantially in the features they supported. Websites sometimes selected content or enabled functionality by looking for a browser’s name in its identification string.\n\nThis practice created incentives for other browsers to include identifiers associated with widely accepted clients. The Mozilla token, originally associated with the early Netscape browser family, consequently became common in browsers that were not Netscape products. Similar compatibility conventions accumulated around rendering engines and browser families.\n\nMany modern strings therefore contain several apparently competing identities. Tokens such as Mozilla/5.0, AppleWebKit, Safari, and like Gecko cannot always be interpreted as literal declarations of the application or engine in use. Their meaning depends on the entire string and the conventions of the particular browser.\n\nThis history illustrates an interoperability problem: once websites depend on an identifier’s exact form, changing it can break access even when the client supports the required functionality."
    },
    {
      "heading": "User-agent detection and feature detection",
      "text": "User-agent detection, also called user-agent sniffing, means selecting behavior by inspecting a client’s identification string. It can support narrowly targeted compatibility workarounds, download selection, or analysis of traffic patterns.\n\nHowever, it has several limitations:\n\n- Different browsers may share many of the same tokens.\n- New browser versions can invalidate parsing rules.\n- Embedded browsers may resemble standalone browsers.\n- Users and automated tools can modify identification strings.\n- A browser family or version does not fully determine its enabled features.\n\nFeature detection instead checks whether a needed capability is available. A script might test for a particular API before calling it, rather than infer support from a browser name. This generally corresponds more directly to the requirement being tested, although an API’s presence does not guarantee bug-free or identical behavior.\n\nBrowser identity also does not reliably establish screen dimensions, input methods, accessibility needs, or whether a request was initiated by a human."
    },
    {
      "heading": "User-Agent Client Hints and identification reduction",
      "text": "User-Agent Client Hints provide another mechanism for exposing selected browser and platform information. Supporting browsers can send structured request fields such as Sec-CH-UA, Sec-CH-UA-Mobile, and Sec-CH-UA-Platform. A server can request additional hints through the Accept-CH response header, subject to browser support, security requirements, permissions policies, and privacy controls.\n\nSome supporting browsers also expose related information through the navigator.userAgentData interface. Support is not universal, and requesting a hint does not guarantee that a browser will provide it.\n\nClient Hints separate categories of information instead of placing everything in a single legacy string. They are associated with efforts to reduce the detail exposed by default through traditional user-agent identification. Such reduction may freeze selected version components or replace precise platform information with more generic values.\n\nClient Hints are not inherently anonymous. More detailed information can still contribute to identifying a browser, and their privacy effects depend on what is exposed and under which conditions."
    },
    {
      "heading": "Privacy, security, and operational limits",
      "text": "User-agent information can contribute to browser fingerprinting when combined with other observable properties. A detailed version or platform string may help distinguish one browser installation from others, creating concerns for data privacy.\n\nThe header is also easy to imitate. A crawler can claim to be a browser, and one browser can identify itself as another. Consequently, a user-agent value is not a credential and does not provide authentication. It is insufficient on its own for access control or for verifying that traffic comes from a particular organization.\n\nOperationally, user-agent strings remain useful for diagnosing compatibility failures, estimating client populations, and investigating unexpected traffic. Their interpretation requires caution: malformed values, spoofing, identification reduction, and automated requests can all distort conclusions.\n\nServers that send different representations according to user-agent information must also account for caching. The HTTP Vary response header can identify request fields that influenced representation selection. Varying on the entire User-Agent field, however, can create many cache variants and reduce cache efficiency because of the large number of possible values."
    }
  ],
  "links": [
    "world-wide-web",
    "web-browser",
    "hypertext-transfer-protocol",
    "email",
    "client-server-model",
    "uniform-resource-locator",
    "http-cookie",
    "html",
    "cascading-style-sheets",
    "javascript",
    "web-accessibility",
    "screen-reader",
    "search-engine",
    "application-programming-interface",
    "operating-system",
    "interoperability",
    "data-privacy",
    "authentication",
    "access-control"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}