简体   繁体   English

检测 iphone 主屏幕上的应用程序

[英]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.

相关问题 iPhone主屏幕Web应用程序和保持登录状态 - iPhone Home Screen Web App and Staying Logged In 从我的应用程序锁定 iPhone 主屏幕 - Lock iphone home screen from my app iPhone WebApps,有没有办法检测它是如何加载的? 主屏与Safari? - iPhone WebApps, is there a way to detect how it was loaded? Home Screen vs Safari? 在iPhone的主屏幕中选择应用程序后,如何向服务器发送请求 - How to send a request to server when the app is selected in home screen in iphone 主屏幕上的iPhone网络应用上的Google appengine身份验证 - Google appengine authentication on iPhone web app on the home screen iPhone Web App —通过“主屏幕”模式启动的链接 - iPhone Web App — Links launched via “Home Screen” mode 应用程序在AppStore和iPhone主屏幕上如何具有不同的名称? - How can an app have different name on AppStore and iPhone home screen? iphone web 应用程序在添加到主屏幕时忽略 cookies - iphone web app ignores cookies when added to home screen 停止重新加载从iPhone主屏幕启动的Web应用程序 - Stop reloading of web app launched from iPhone Home Screen iPhone / CSS - 如果网站设置为主屏幕应用程序,则更改样式 - iPhone / CSS - change styling if site set as a home screen app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM