简体   繁体   中英

Requesting a JavaScript property in Python (GAE)

I'm currently making an iphone web app based on Google App Engine (python). I need to check if the user is browsing not through safari but by the home screen. I can check this with an read-only 'window.navigator.standalone' Boolean JavaScript property as read on: https://developer.apple.com/library/archive/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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM