The HTTP headers User-Agent is a request header that allows a characteristic string that allows network protocol peers to identify the Operating System and Browser of the web-server. Your browser sends the user agent to every website you connect to. There is no conventional way of writing a user agent string as different browsers use different formats and many web browsers load a lot of information onto their user agents.
When your browser is connected to a website, a User-Agent field is included in the HTTP header. The data of the header field varies from browser to browser. This information is used to serve different websites to different web browsers and different operating systems.
User-Agent: <product> / <product-version> <comment>
User-Agent: Mozilla/<version> (<system-information>) <platform> (<platform-details>) <extensions>
Directives There are three directives in HTTP headers user-agent.
- product: This holds the product identity.
- product-version: This holds the product version of the used product.
- comment: This holds the sub-product information of the used product
You can also check your User-agent with the help of http://whatsmyuseragent.com/.
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
The following conclusions can be drawn with the help of user-agent header:
- The user agent application is Mozilla version 5.0.
- The operating system is NT version 10.0 (and is running on a Windows(64-bit) Machine).
- The engine responsible for displaying content on this device is AppleWebKit version 537.36 (KHTML, an open-source layout engine, is present too).
- The client is Chrome version 77.0.3865.90.
- The client is based on Safari version 537.36.
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.3 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/43.4
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
Mozilla/5.0 (iPhone; CPU iPhone OS 11_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1
Supported Browsers: The browsers compatible with HTTP headers User-Agent are listed below:
- Google Chrome
- Internet Explorer
- HTTP headers | Age
- HTTP headers | Via
- HTTP headers | X-XSS-Protection
- HTTP headers | Host
- HTTP headers | Accept
- HTTP headers | If-None-Match
- HTTP headers | Set-Cookie2
- HTTP headers | Origin
- HTTP headers | Last-Modified
- HTTP headers | Digest
- HTTP headers | Range
- HTTP headers | Retry-After
- HTTP headers | Date
- HTTP headers | Cookie
- HTTP headers | Expect
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.