Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 472
vhakti Avatar asked Mar 18 '11 03:03

vhakti


People also ask

Can you run a website from an iPhone?

Whether you're learning web development and want to host your own HTML files on your iPhone, or whether you just want to play around with a server without being restricted to using a laptop or a computer to install MAMP, your iPhone can do it for you.

How do I get links to open in browser instead of app on iPhone?

Go to Settings and scroll down until you find the browser app or email app. Tap the app, then tap Default Browser App or Default Mail App.


4 Answers

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

like image 180
GameLoading Avatar answered Nov 01 '22 09:11

GameLoading


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];
like image 37
Abdullah Al Farooq Avatar answered Nov 01 '22 09:11

Abdullah Al Farooq


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

like image 26
Anomie Avatar answered Nov 01 '22 09:11

Anomie


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].

like image 36
TheBlack Avatar answered Nov 01 '22 09:11

TheBlack