Reputation: 1407
Is there a way of telling whether my Web Application has been launched from a button on the user's iPhone home screen? I want to display a "add this WebApp to your home screen" prompt if the user has accessed the WebApp via safari by typing in a URL.
Upvotes: 9
Views: 4595
Reputation: 769
window.navigator.standalone
True if you have launched from the Home Screen. False if in the Safari browser.
Documented here:
It works with OS 2.1 and up.
Upvotes: 25
Reputation: 180004
jQTouch detects this (try the demo). It's open source, so you should be able to find out how.
Upvotes: 1
Reputation: 13753
If I remember correctly there's a thing in the server log that shows what the user's previous page was. So the only way I can think of is if the user was on a previous page display the "add" thing, and if they didn't don't
Upvotes: 0
Reputation: 32316
In Safari, the scrollY
will start at a negative value if inside Safari, and at 0 if running as an application.
Likely the viewport will change as well (if it does, this is a more reliable method)
Upvotes: 2