Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a user agent?

I see many web development tools that let me change this thing called the user agent. What is it?

like image 838
Gordon Gustafson Avatar asked Mar 10 '26 15:03

Gordon Gustafson


2 Answers

The user agent doesn't change how Safari renders a page, it just changes what browser Safari pretends to be when making the HTTP request, and when calling navigator.userAgent in JavaScript. Some web servers and some JavaScript on web pages will change their behavior based on the user agent (which is generally a bad idea), and so sometimes if a web server gives you a page back saying "Sorry, your browser isn't supported", you may want to change your user agent to IE to see if it actually works even though they don't support it.

like image 145
Brian Campbell Avatar answered Mar 12 '26 18:03

Brian Campbell


Maybe I am missing something but, neither of the answers actually answer the original question - "what is a user-agent?".

Answer: In the context of the World Wide Web, a user agent is simply the program that contacts the web server on behalf of the user. Majority of user agents are general purpose browsers. Very few are search engine spiders.

Slightly Long answer: http://en.wikipedia.org/wiki/User_agent

In the context of your question - the thing that tools allow us to change - User Agent refers to the user-agent HTTP header that the client program sends with each request to identify itself.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!