PDA

View Full Version : How to bring up a browser within an app?




sparetire
Aug 9, 2008, 03:54 AM
This must be a stupid question but I couldn't quite figure out.

How do I bring up a browser from an iPhone app? Mind sharing some code samples?

Is there a way to embed an url within an app (eg. like an iframe)?

Thank you in a advance.

-Simon



firewood
Aug 9, 2008, 12:07 PM
Look in the UIWebView documentation. You can also launch Safari with a URL.

louden
Aug 9, 2008, 11:22 PM
Check out "The Elements" example for calling up a web page from an app. They call up wikipedia.

sfwalter
Aug 10, 2008, 10:13 AM
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://macrumors.com"]];

Sbrocket
Aug 10, 2008, 02:39 PM
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://macrumors.com"]];

Keep in mind that this closes your application and launches Safari. This would not be the way to go about an embedded browser - WebKit through UIWebView is the way to do that.

sparetire
Aug 11, 2008, 12:10 PM
Keep in mind that this closes your application and launches Safari. This would not be the way to go about an embedded browser - WebKit through UIWebView is the way to do that.

Does UIWebView work like an iframe? If I click on a link within the WebView, what will happen? Doe it terminate my app and take the user to Safari?

Thanks.

Simon