Intern
What is a User Agent?
sobes.tech AI
Answer from AI
User Agent - a string that identifies the client application making a request to the server (e.g., a web browser, search robot, etc.). It is sent in the HTTP header User-Agent.
Example structure (may vary):
ProductName/Version [Comments, OS Type, Language...]
Uses of User Agent:
- Client type identification: The server can adapt content for a specific browser or device.
- Analytics: Web analytics use User Agent to collect statistics about site visits.
- Blocking: Site owners can block access based on User Agent (e.g., for bots).
- Testing: QA uses modified User Agents to simulate different browsers/devices.
Example HTTP header:
GET /index.html HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
In this example:
Mozilla/5.0- a common marker, not always matching the actual engine.Windows NT 10.0; Win64; x64- information about the operating system.AppleWebKit/537.36 (KHTML, like Gecko)- rendering engine information.Chrome/91.0.4472.124- browser name and version.Safari/537.36- often included for compatibility with older sites that check for "Safari" in User Agent.