[英]Detect an app on home screen of iphone
You know how its possible to add a web app to the home screen of an iPhone... well now how do i detect if my app has been added to the home screen of a user's iPhone.您知道如何将 web 应用程序添加到 iPhone 的主屏幕......现在我如何检测我的应用程序是否已添加到用户 iPhone 的主屏幕。
And if it has been added, how do i launch the app stored on the user's home screen rather than in Safari.如果已添加,我如何启动存储在用户主屏幕上而不是 Safari 中的应用程序。
NOTE: its a web app simply bookmarked on the home screen of an iPhone - it is NOT a native app.
Any Ideas?有任何想法吗?
According to Safari Web Content Guide , you have to set <meta name="apple-mobile-web-app-capable" content="yes" />
in your webpage to present your content in full-screen mode.根据Safari Web 内容指南,您必须在网页中设置
<meta name="apple-mobile-web-app-capable" content="yes" />
以全屏显示您的内容。
You can also set a startup image to make it look like a native app by setting <link rel="apple-touch-startup-image" href="/startup.png">
您还可以通过设置
<link rel="apple-touch-startup-image" href="/startup.png">
来设置启动图像,使其看起来像原生应用程序
Edit (Detect if run in full-screen mode)编辑(检测是否以全屏模式运行)
You can add some JS-Code to your webpage to detect if it is run in full-screen mode:您可以在网页中添加一些 JS 代码来检测它是否以全屏模式运行:
<script type="text/javascript">
if ('standalone' in navigator && !navigator.standalone && (/iphone|ipod|ipad/gi).test(navigator.platform) && (/Safari/i).test(navigator.appVersion)) {
__do something here__
}
For more information on this, this project could be of interest.有关这方面的更多信息,这个项目可能会很有趣。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.