您知道如何将web应用程序添加到iPhone的主屏幕上……那么,现在我该如何检测我的应用程序是否已添加到用户iPhone的主屏幕上。
如果添加了应用程序,如何启动存储在用户主屏幕上的应用程序而不是Safari中的应用程序。
NOTE : its a web app simply bookmarked on the home screen of an iPhone - it is NOT a native app.
有什么想法吗?
发布于 2011-08-11 03:23:06
根据Safari Web Content Guide的说法,你必须在你的网页中设置<meta name="apple-mobile-web-app-capable" content="yes" />来以全屏模式呈现你的内容。
您还可以通过设置<link rel="apple-touch-startup-image" href="/startup.png">来设置启动映像,使其看起来像本机应用程序
编辑(检测是否在全屏模式下运行)
您可以添加一些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__
}有关这方面的更多信息,this project可能会感兴趣。
https://stackoverflow.com/questions/7015962
复制相似问题