Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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.

The user agent switching is not a "mode" all it does is makes Safari report the IE/Firefox/etc user agent -- so navigator.userAgent will report the UA of a different browser.

This is only really useful when you're looking at supporting safari (or webkit in general) and want to rule out user agent checks as the cause of "incompatibilities"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top