vhakti
vhakti

Reputation: 368

How to launch a browser from an Iphone application

Any idea how to launch an instance of Safari from an Iphone or Ipad application? But the case its that I would like to manipulate some aspects of the Safari window, for example I would like to launch it in Kiosk mode, without the addres bar.

I found something like openUrl but I am not sure if it is the best way and I can customize the windows properties etc...

Upvotes: 11

Views: 13695

Answers (6)

Abdullah Al Farooq
Abdullah Al Farooq

Reputation: 518

From iOS 10.0 this is deprecated,

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com"]];

You need to use this instead to get the same old behavior,

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com"] options:[NSDictionary dictionary] completionHandler:nil];

Upvotes: 2

GameLoading
GameLoading

Reputation: 6708

Do the same

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com"]];

//Swift

UIApplication.sharedApplication().openURL(NSURL.init(string: "https://www.google.com")!)

SFSafariViewController, An object that provides a standard interface for browsing the web.

check this

Upvotes: 49

Manigandan P.S
Manigandan P.S

Reputation: 170

for with query string

NSURL *url = [NSURL URLWithString:@"/%s/%s","http://www.facebook.com","?opt=value"];  
[[UIApplication sharedApplication] openURL:url];

for without query string

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]];

Upvotes: 0

vhakti
vhakti

Reputation: 368

ok, finally I found a great solution and very simple :), in Interface builder there is an object called: Web View , it offers the web browsing capabilities in a kiosk mode without need to use safari.

Upvotes: 0

TheBlack
TheBlack

Reputation: 1245

Each iOS app is sandboxed,meaning, it cannot interact with other apps. The only (if I'm not mistaken) way to communicate outside sandbox with system and other apps is trough [UIApplication sharedApplication].

Upvotes: 1

Anomie
Anomie

Reputation: 94834

openURL is the only (public) way to launch an instance of Safari, or of any other application.

Upvotes: 1

Related Questions