简体   繁体   中英

Can an iOS app add a website shortcut to the Home Screen?

Could a button in an iOS app trigger a process to add a website shortcut to the device Home Screen?

For example company A releases an app through the App Store. This contains a button to add a shortcut to company A's website on the Home Screen of the phone or tablet.

Cheers.

I was looking to achieve something similar once & I am pretty sure it cannot be done -- iOS simply won't allow it.

You have 3 options for your button action --

  1. Present UIActivityViewController with your website Url (it will the have option to "Add to Reading List", but it won't have "Add to Home Screen")
  2. Present SFSafariViewController with the website Url, you can open an alert view to tell the user to add to bookmarks perhaps. (it will the have option to "Add to Reading List" & "Add to Bookmarks", but it won't have "Add to Home Screen")
  3. Launch Safari & open the website with some parameter triggered javascript code to tell the user to select "Add to Home Screen".

None of them come close to what you want and are not particularly elegant. But I don't see any other way. (In our case, we just went with launching the Safari)

Here's an old link I found, not much has changed -- iPhone SDK - Add a "Add to Home Screen" button in a UIWebView

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM