title: Open external links in a new tab without jQuery
body: <p>What's the best way to open all external links (URLs that don't match the current domain) in a new tab using JavaScript, without using jQuery?</p>
  
  <p>Here's the jQuery I'm current using:</p>
  
  <pre><code>// Open external links in new tab
  $('a[href^=http]').click(function () {
      var a = new RegExp('/' + window.location.host + '/');
      if (!a.test(this.href)) {
          window.open(this.href);
          return false;
      }
  });
  </code></pre>