user2512457
user2512457

Reputation: 9

Link from iOS app to website

I am looking to link my iOS app to my website. I want the link to open the safari web browser. Currently the link goes to the website but stays in the app.

Here is what I am using:

<a   onclick="window.location.href='http://www.website.com/folder/page.php';">Contact</a>

Any suggestions?

Upvotes: -1

Views: 1242

Answers (1)

Mahendra
Mahendra

Reputation: 8914

To open a webpage in device's browse, use following code

NSURL *strURL = [[NSURL alloc] initWithString:@"http://www.website.com/folder/page.php"];
if ([[UIApplication sharedApplication] canOpenURL:strURL]) {
    [[UIApplication sharedApplication] openURL:strURL];
} else {
    NSLog(@"Cann't open url : %@",strURL);
}

Upvotes: 1

Related Questions