title: Cannot catch window.open() exception in Safari
body: <p>I have some code that opens a link. The link is configurable and thus I am doing some basic error handling. Specifically I am wrapping the <code>window.open()</code> call with a try/catch since the built in API will throw an exception if the URL is invalid. The issue is that in Safari the catch doesn't get hit. </p>
  
  <p>I've tried looking through the Safari API but I cannot find any good information. </p>
  
  <p>The below example works just fine in IE and Chrome but NOT in Safari.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function() {
    $('button').on("click", function() {
      try {
        var begin = "http://&lt;";
        var opentag = "script&gt;";
        var stuff = "function(){alert('unsafe');}";
        var all = begin + opentag + stuff;
        window.open(all);
      } catch (e) {
        alert("errr");
      }
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;button&gt;
  Click ME
  &lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>