Javascript window.navigator.standalone broken

隐身守侯 提交于 2019-12-04 18:52:28

问题


really annoying me now,

I've stripped my code down to this

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

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

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


回答1:


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.



来源:https://stackoverflow.com/questions/10639858/javascript-window-navigator-standalone-broken

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!