title: Cocoa/WebKit, having "window.open()" JavaScript links opening in an instance of Safari
body: <p>I am building a really basic Cocoa application using WebKit, to display a Flash/Silverlight application within it. Very basic, no intentions for it to be a browser itself.</p>
  
  <p>So far I have been able to get it to open basic html links (<code>&lt;a href="..." /&gt;</code>) in a new instance of Safari using </p>
  
  <pre><code>[[NSWorkspace sharedWorkspace] openURL:[request URL]];
  </code></pre>
  
  <p>Now my difficulty is opening a link in a new instance of Safari when <code>window.open()</code> is used in JavaScript.  I "think" (and by this, I have been hacking away at the code and am unsure if i actually did or not) I got this kind of working by setting the WebView's <code>policyDelegate</code> and implementing its</p>
  
  <pre><code>-webView:decidePolicyForNavigationAction:request:frame:decisionListener:
  </code></pre>
  
  <p>delegate method.  However this led to some erratic behavior.</p>
  
  <p>So the simple question, what do I need to do so that when <code>window.open()</code> is called, the link is opened in a new instance of Safari.</p>
  
  <p>Thanks</p>
  
  <p>Big point,  I am normally a .NET developer, and have only been working with Cocoa/WebKit for a few days.</p>