IPhone Offline Detection

Hi guys, I am trying to determine if the jquerymobile application works as an APP (for example, from the main screen). My current code is:
if (window.navigator.standalone) Data.isRunningAsApp = true; 

The problem is that I heard that this code better matches this

 if (("standalone" in window.navigator) && !window.navigator.standalone) {} 

I get what the first segment does (testing - this property exists), but I do not understand the second segment. (In terms of syntax, I thought I did, but it seems contradictory to me!)

+4
source share
2 answers

Read the paragraph above for sample code in a blog post. if detects a supported browser that is not in application mode .

+4
source

It's simple:

  • first checks to see if the window.navigator object has the "standalone" property

  • then comparing the window.navigator.standalone property with FALSE →! window.navigator.standalone is the same as window.navigator.standalone! = true

+1
source

Source: https://habr.com/ru/post/1382967/


All Articles