问题
I have found this site http://cubiq.org/add-to-home-screen which has javascript for showing a bubble to encourage the user in Safari to create a shortcut to the web page, but I was wondering if anyone has a way to swap the web page url with the native app custom url scheme before creating the shortcut.
回答1:
In some situations it can be helpful to have a few shortcuts to start an app from a custom URL with different parameters. For example if you have an application that is a container for a few little applications. So, to start one of such little apps directly. without a menu you can use a custom URL with the app name as a parameter.
I spent some time trying to find the solutions. I found to ways:
This link explains how to make a custom url shortcut saving it from Safari using a special html file prepared. This method relies on the html page refresh to a custom URL, and requires an internet connection. A side effect - when you start the app from a shortcut you shortly see Safari opening the html page before your app starts.
And this link explains how to do that with the iPhone Configuration Utility. This approach requires an installation of configuration profile on you device. A side effect of this method what I see is - after you start your application from a shortcut you see two applications in the background - your app, and the Web clip (the shortcut).
来源:https://stackoverflow.com/questions/13723188/iphone-custom-url-scheme-add-shortcut-to-homescreen