Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone SDK - Add a "Add to Home Screen" button in a UIWebView

I have a native iPhone app, which has a UIWebView component to it. I am trying to see if I can replicate the "Add to Home Screen" button that is present in the tab bar options in Safari.

Is this possible inside a UIWebView within a native app?

Thanks! Brett

like image 850
Brett Avatar asked May 31 '12 15:05

Brett


1 Answers

[I presume your question is about replicating the action associated with add to home screen, rather than replicating the appearance of the button itself (which being pedantic is what you actually wrote).]

As others have said this isn't possible.

What you could do is programatically launch Safari from within your app and give it the URL of a page to load which is your page.

When your page is loaded it has some sort of animation and shows the user where the add to home screen button is and tell them to press it after clicking a link which is displayed in your web page. When the users click on the link it takes them to whatever page it is that you would like saved to the desktop, and you hope they follow your instructions.

If you register your app to handle a proprietary url scheme the users can get back to your app from within Safari by clicking on a link using your app's url scheme.

The web pages that you seed Safari with must however be remote pages, you cannot give Safari a page in your app's bundle or that your app has downloaded as Safari cannot read pages from your app's sandbox.

like image 76
Gruntcakes Avatar answered Oct 22 '22 01:10

Gruntcakes