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

James Mills prologic at shortcircuit.net.au
Mon Jan 31 17:46:55 EST 2011


On Tue, Feb 1, 2011 at 8:16 AM, Sascha <samzielkeryner at gmail.com> wrote:
> 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?

I have an iPad and just wrote a simple demo app to test this:

http://prologic.no-ip.org:8000/

Source: http://codepad.org/zdZJgm1j

Basically if you check for the string "iPad" in
the User-Agent header. Obviously this only
works for iPads running IOS and the built-in
Safari Web Browser - but I'm sure other tablet/mobile
devices provide similar unique User-Agent strings.

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"



More information about the Python-list mailing list