13

You know how its possible to add a web app to the home screen of an iPhone... well now how do i detect if my app has been added to the home screen of a user's iPhone.

And if it has been added, how do i launch the app stored on the user's home screen rather than in Safari.

NOTE : its a web app simply bookmarked on the home screen of an iPhone - it is NOT a native app.

Any Ideas ?

2
  • I don't get it. Web apps only run in Safari.
    – dasdom
    Commented Aug 10, 2011 at 18:50
  • yes you are right, but i want it to run in full screen without the header address bar and the footer icons which are default in safari. is that possible ?
    – smoizs
    Commented Aug 10, 2011 at 18:52

1 Answer 1

30

According to Safari Web Content Guide, you have to set <meta name="apple-mobile-web-app-capable" content="yes" /> in your webpage to present your content in full-screen mode.

You can also set a startup image to make it look like a native app by setting <link rel="apple-touch-startup-image" href="/startup.png">

Edit (Detect if run in full-screen mode)

You can add some JS-Code to your webpage to detect if it is run in full-screen mode:

<script type="text/javascript">
if ('standalone' in navigator && !navigator.standalone && (/iphone|ipod|ipad/gi).test(navigator.platform) && (/Safari/i).test(navigator.appVersion)) {
    __do something here__
}

For more information on this, this project could be of interest.

2
  • 1
    ok .. this works well if the app is added to the home screen .. but not in Safari. The question actually is - if there is a way to detect if an app has been added to the home screen and if it can be opened if someone visits a URL
    – smoizs
    Commented Aug 10, 2011 at 19:48
  • 2
    Hi! yes this helps .. to detect if the webpage has been added to homescreen or not! thanks a ton. I think i can work around this.
    – smoizs
    Commented Aug 11, 2011 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.