判断WebApp是通过iPhone主屏幕上的URL或链接启动的 [英] Tell if WebApp launched via URL or link on iPhone home screen

查看:88
本文介绍了判断WebApp是通过iPhone主屏幕上的URL或链接启动的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法告诉我的Web应用程序是否已从用户iPhone主屏幕上的按钮启动?如果用户通过输入URL通过safari访问WebApp,我想显示将此WebApp添加到主屏幕提示。

Is there a way of telling whether my Web Application has been launched from a button on the user's iPhone home screen? I want to display a "add this WebApp to your home screen" prompt if the user has accessed the WebApp via safari by typing in a URL.

推荐答案

window.navigator.standalone

window.navigator.standalone

如果您已从主屏幕启动,则为真。如果在Safari浏览器中则为False。

True if you have launched from the Home Screen. False if in the Safari browser.

此处记录:

https://developer.apple.com/library/content/documentation/AppleApplications/Reference/ SafariHTMLRef / Articles / MetaTags.html

适用于OS 2.1及更高版本。

It works with OS 2.1 and up.

这篇关于判断WebApp是通过iPhone主屏幕上的URL或链接启动的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆