Detect if iOS is using webapp Detect if iOS is using webapp ios ios

Detect if iOS is using webapp


You have to detect this by using some javascript:

<script>if (("standalone" in window.navigator) &&       // Check if "standalone" property exists    window.navigator.standalone){               // Test if using standalone navigator    // Web page is loaded via app mode (full-screen mode)    // (window.navigator.standalone is TRUE if user accesses website via App Mode)} else {    // Web page is loaded via standard Safari mode    // (window.navigator.standalone is FALSE if user accesses website in standard safari)}</script></head> 

Now the extra check "standalone" in window.navigator is needed because some browsers do not have the standalone property and you don't want your code to crash for those browsers.


iOS and Chrome WebApp behaves different, thats the reason i came to following:

isInWebAppiOS = (window.navigator.standalone == true);isInWebAppChrome = (window.matchMedia('(display-mode: standalone)').matches);