Determine from a HTTP request if the user is on a Smart Phone, IE, Firefox

Ben Finney ben+python at benfinney.id.au
Mon Jan 31 20:53:35 EST 2011


Sascha <samzielkeryner at gmail.com> writes:

> I am returning specialised website html according to what platform the
> user is on. Is there a way to determine if the user is on a Smart
> Phone or on IE or on Firefox?

The HTTP standard defines the “User-Agent” field, to be sent as part of
the request header <URL:http://en.wikipedia.org/wiki/User_agent>.

Note that this information is often abused by web server operators, and
the response of many users is to mangle or fabricate this field before
it is sent to the server. (My browser, for example, instructs the reader
to stop obsessing about User-Agent and to code for web standards instead
<URL:http://linuxmafia.com/faq/Web/user-agent-string.html>.)

-- 
 \           “If you do not trust the source do not use this program.” |
  `\                                —Microsoft Vista security dialogue |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list