iPhone WebApps,有没有办法检测它是如何加载的?主屏幕与Safari? [英] iPhone WebApps, is there a way to detect how it was loaded? Home Screen vs Safari?

查看:134
本文介绍了iPhone WebApps,有没有办法检测它是如何加载的?主屏幕与Safari?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iPhone网络应用程序,我有兴趣检测应用程序是否已加载:

I have an iPhone Web App, and I'm interested in detecting if the app was loaded either from:


  1. iPhone Safari

  2. iPhone安装的网络应用程序(通过添加到我的主屏幕)加载没有野生动物园酒吧。

任何想法?

推荐答案

您可以使用window.navigator确定网页是否以全屏模式显示。独立的只读布尔JavaScript属性。 https://developer.apple.com/ library / content / documentation / AppleApplications / Reference / SafariHTMLRef / Articles / MetaTags.html

You can determine whether a webpage is displayed in full-screen mode using the window.navigator.standalone read-only Boolean JavaScript property. https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html

if (window.navigator.standalone) {
    // fullscreen mode

}

这篇关于iPhone WebApps,有没有办法检测它是如何加载的?主屏幕与Safari?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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