开发者

Requesting a JavaScript property in Python (GAE)

开发者 https://www.devze.com 2022-12-22 10:54 出处:网络
I\'m cur开发者_JS百科rently 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 re

I'm cur开发者_JS百科rently 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消