Plasma
Plasma

Reputation: 2902

Open Mobile Safari without using openURL:url

I want to open the Mobile Safari app "WITHOUT" changing its currently displayed page.

I can easily switch to Safari using ..

NSString *ourPath = @"http://www.google.co.uk";
NSURL *ourURL = [NSURL URLWithString:ourPath];
if ([ourApplication canOpenURL:ourURL]) {
    [ourApplication openURL:ourURL];
}

But what I want to do is just switch to safari and not navigate away from the page it is currently on. Like when I switch using the task switcher, it just pops Safari and leaves it on the page it was.

I've tried sending it a url of @"http:" but this doesn't work it changes pages to to "http:localhost/"

Is there a way to just Open it?

Plasma

Upvotes: 5

Views: 2379

Answers (2)

Plasma
Plasma

Reputation: 2902

I solved this using the answers on this page ..

iOS How can I use UIApplication launchApplicationWithIdentifier which is in private APIs?

Though I didn't have to move my .app file in to /Applications

It was enough to add the entitlements, then simply call it using ...

[[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.apple.mobilesafari" suspended:NO];

Plasma

Upvotes: 3

TomSwift
TomSwift

Reputation: 39512

Could you open to a page that executes JavaScript history.back() when loaded?

Upvotes: 0

Related Questions