web applications - Javascript window.navigator.standalone broken - Stack Overflow

really annoying me now,I've stripped my code down to this$(function(){if ( ("standalone"

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.

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.

Share Improve this question edited May 17, 2012 at 16:42 Sampson 269k76 gold badges545 silver badges568 bronze badges asked May 17, 2012 at 16:41 owenmelbzowenmelbz 6,58418 gold badges69 silver badges121 bronze badges 2
  • 1 gah, I had different code before, without the ! and saw someone said this above code was more reliable. so i just swapped it out without noticing the ! thanks. – owenmelbz Commented May 17, 2012 at 16:50
  • 2 You should post that as an answer and accept it so that your question doesn't appear in the unanswered tab. – Alexandre Khoury Commented Jun 30, 2012 at 14:49
Add a ment  | 

1 Answer 1

Reset to default 8

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743776065a4505254.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信