Open URL with Safari no matter what system browser is set to

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2010-06-03T11:50:07Z Indexed on 2010/06/03 11:54 UTC
Read the original article Hit count: 164

Filed under:
|
|

In my objective-c program, I need to open a URL in Safari no matter what the system's default browser is. That means that this won't work, because it could launch Firefox or whatever other browser:

NSWorkspace * ws = [NSWorkspace sharedWorkspace];
[ws openURL: url];

I think I'm close with this:

[ws launchAppWithBundleIdentifier: @"com.apple.Safari"
                          options: NSWorkspaceLaunchWithoutActivation
   additionalEventParamDescriptor: NULL
                 launchIdentifier: nil];

only need to figure out how to pass in the URL as parameter... Is there an easier way?

Thanks!

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about safari