For mobile web development: I am making a website which asks the user (on an iPhone or iPod Touch) to save the page as a bookmark on the homescreen.
I do not want to show this message when the user already has a bookmark, so how can I check that (preferably using JavaScript, I don't know any other way).
Any tips are welcome.
You can check it with JavaScript via window.navigator.standalone. Look here for details.
ReplyDeleteif (("standalone" in window.navigator) &&!window.navigator.standalone) {
// Show the text for adding it as a 'bookmark'/app on home screen.
}
You can use this meta tag in your index file
ReplyDelete<meta name="apple-mobile-web-app-capable" content="yes" />
EDIT: To clarify: when the user uses to bookmark to access the page, the message shouldn't be displayed anymore. I have used the JS project Add 2 Home with success