views:

24

answers:

1

Hello again!

I'm currently making an iphone web app based on Google App Engine (python). I need to check if the user is browsing not trough safari but by the home screen. I can check this with an read-only 'window.navigator.standalone' Boolean JavaScript property as read on :http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html

How can I read this Boolean in Python? I guess by self.request.headers.get() or something but it won't work.

Thanks in advance!

+2  A: 

According to this page on HTTP headers and MobileSafari, you can tell if the user has launched your site from their home screen by testing to see whether the string Safari is found in the HTTP_USER_AGENT header. If it's missing, they are browsing from the home screen.

This seems awfully fragile (and doesn't appear to be documented outside of a couple of non-Apple blog posts), so it might not be the best thing to rely on.

Will McCutchen
But it works for now! A native app is comming up, so this is good enough for testing purposes.
Jelle