本文介绍了Javascript window.navigator.standalone损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在真的很烦我

我已将代码剥离为此

$(function(){
  if ( ("standalone" in window.navigator) && !window.navigator.standalone ) {
    alert('full screen');
  }
});

但是,每次我在ipad上通过Safari浏览器运行此命令时,警报就会消失.

yet every time I run this on my ipad FROM safari it kicks out the alert.

我不知道为什么,这会导致星期一到期的整个uni项目混乱!任何帮助都将是惊人的.

I've no idea why and its causing chaos to my whole uni project which is due monday! Any help would be amazing.

推荐答案

当/如果网页处于标准/常规Safari模式下,则"window.navigator.standalone"值将为False.仅当网页处于应用程序模式/即全屏模式"时,此值才为True.注意:此JavaScript值在不支持应用程序模式/即全屏模式"的浏览器中不存在.因此,您应该同时测试window.navigator.standalone属性的存在性和真实性.

When/if the web page is in standard/usual Safari mode, the "window.navigator.standalone" value will be False. Only when the web page is in "app mode/i.e. full screen mode", this value will be True. NOTE: this JavaScript value does not exist in browsers that do not support "app mode/i.e. full screen mode". So you should test both for the very existence of the property window.navigator.standalone as well as for its truthfulness.

这篇关于Javascript window.navigator.standalone损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 19:13