如何检测该Web应用程序在应用程序模式或Safari模式下运行 [英] how to detect that web app is running in app mode or in safari mode

查看:154
本文介绍了如何检测该Web应用程序在应用程序模式或Safari模式下运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查网页是否在带有地址栏的Safari模式下运行,或者在iPad中没有地址栏的应用模式下运行

How to check that a web page is running in safari mode with address bar or in app mode without address bar in iPad

             <script>
              if (window.navigator.standalone) {

                  <link type="text/css" href="ipad.css" rel="stylesheet" />



              }


              els{

                  <link type="text/css" href="safari.css" rel="stylesheet" />

              }

              </script>


推荐答案

在应用程序模式下,我假设你的意思是什么时候推出从主屏幕:

By in app mode I assume you mean when it's launched from the home screen:

if (window.navigator.standalone) {

    /* Launched from home screen code */

}

这适用于所有iOS设备ASAIK 。

This works on all iOS devices ASAIK.

这篇关于如何检测该Web应用程序在应用程序模式或Safari模式下运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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