Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I detect if my appengine app is being accessed by an iphone/ipod touch?

I need to render the page differently if it's acessed by an iphone/ipod touch. I suppose the information is in the request object, but what would be the syntax?

like image 984
Steph Thirion Avatar asked Mar 05 '09 23:03

Steph Thirion


1 Answers

This is the syntax I was looking for, works with iphone and ipod touch:

uastring = self.request.headers.get('user_agent')
if "Mobile" in uastring and "Safari" in uastring:
  # do iphone / ipod stuff
like image 110
Steph Thirion Avatar answered Nov 09 '22 18:11

Steph Thirion