title: Open URL with Safari no matter what system browser is set to
body: <p>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:</p>
  
  <pre><code>NSWorkspace * ws = [NSWorkspace sharedWorkspace];
  [ws openURL: url];
  </code></pre>
  
  <p>I think I'm close with this:</p>
  
  <pre><code>[ws launchAppWithBundleIdentifier: @"com.apple.Safari"
                            options: NSWorkspaceLaunchWithoutActivation
     additionalEventParamDescriptor: NULL
                   launchIdentifier: nil];
  </code></pre>
  
  <p>only need to figure out how to pass in the URL as parameter... Is there an easier way?</p>
  
  <p>Thanks!</p>
  
  <p><em>Update:</em> The following code launches Safari with the URL I want, but Safari terminates right away! Any ideas why this is?</p>
  
  <pre><code>NSWorkspace * ws = [NSWorkspace sharedWorkspace];
  [ws openURLs: urls withAppBundleIdentifier:@"com.apple.Safari" 
       options: NSWorkspaceLaunchDefault
  additionalEventParamDescriptor: NULL
  launchIdentifiers: NULL];
  </code></pre>
  
  <p>I observed the same behavior with <code>LSOpenFromURLSpec</code>. If a Safari instance is running, it works fine. If no Safari instance was running, it starts a new one and terminates it right away.</p>
  
  <p><em>Update 2:</em> Safari only crashes for web sites that have Flash embedded. With the code above, I can open google.com just fine, however Safari crashes for a YouTube video, for example.</p>