Javascript for "Add to Home Screen" on iPhone?

Kerrick picture Kerrick · Jul 17, 2009 · Viewed 171.6k times · Source

Is it possible to use Javascript to emulate the Add to Home Screen option in Mobile Safari's bookmark menu?

Something similar to IE's window.external.AddFavorite(location.href, document.title); possibly?

Answer

Craig picture Craig · Feb 12, 2011

Until Safari implements Service Worker and follows the direction set by Chrome and Firefox, there is no way to add your app programatically to the home screen, or to have the browser prompt the user

However, there is a small library that prompts the user to do it and even points to the right spot. Works a treat.

https://github.com/cubiq/add-to-homescreen