iphonemobileweb-applicationsiphone-standalone-web-app

iPhone WebApps, is there a way to detect how it was loaded? Home Screen vs Safari?


I have an iPhone Web App, and I'm interested in detecting if the app was loaded either from:

  1. iPhone Safari
  2. iPhone installed web app (via the add to my home screen) which loads without the safari bars.

Any ideas?


Solution

  • You can determine whether a webpage is displayed in full-screen mode using the window.navigator.standalone read-only Boolean JavaScript property. https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html

    if (window.navigator.standalone) {
        // fullscreen mode
    
    }