यह कैसे काम करता है
A user agent is a space-separated list of product tokens, each optionally followed by a slash and a version, with parenthesised comments carrying platform details. The first token is conventionally Mozilla/5.0, which has been a lie since 1993: it survives because sites once sniffed for it and browsers that did not send it were served broken pages, and the practice has never been undone. Modern Chrome sends Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36, which names three rendering engines and is accurate about one.
That last example shows why order matters. Safari and Chrome both claim AppleWebKit, and both claim Safari, so a parser looking for the substring Safari will classify Chrome as Safari. The convention is to scan for the most specific token first — Edge, then Opera, then Chrome, then Safari — which is the origin of the Chromium-based browsers adding their own tokens such as Edg/ and OPR/. A parser that gets the order wrong misattributes Chrome's entire market share to Safari, and this has happened in shipped analytics products.
Client Hints were introduced because the UA string is both too long and too coarse. Chrome freezes the minor version, reports a reduced platform string, and expects sites to request high-entropy details such as the exact model and platform version through the Sec-CH-UA headers instead. The consequence is that UA parsing increasingly yields approximate results for Chromium browsers, and any feature detection that depends on an exact version is fragile by design. Feature detection through the platform APIs is more durable than version sniffing.
Bot detection is a separate problem and a heuristic one. Most crawlers, monitors and libraries announce themselves — Googlebot, bingbot, curl, python-requests, Go-http-client — but any client can set the header to anything, so a UA claiming to be Googlebot proves nothing. Real verification requires a reverse DNS lookup confirming the source address belongs to the claimed operator, which is a server-side operation. Use the bot flag for analytics segmentation, never for access control, and never for security decisions.
सामान्य उपयोग के मामले
- Diagnose a bug report by confirming which browser and version the reporter is actually using.
- Segment analytics to exclude bot traffic from conversion figures.
- Check whether a crawler is passing through your site and which one.
- Confirm which device class a mobile-only or desktop-only redirect is seeing.
- Investigate a request log full of unfamiliar UA strings to identify a scanner.
- Verify that your own client library is sending the header you think it is.
अंतिम अद्यतन: 2026-10-14 — लेख का मुख्य भाग अंग्रेज़ी में दिखाया गया है; इंटरफ़ेस का अनुवाद हो चुका है।