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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.