Make All External Links Open In A New Window

$('a').each(function() {
   var a = new RegExp('/' + window.location.host + '/');
   if (!a.test(this.href)) {
       $(this).attr('target', '_blank');
   }
});
Tweet It. Share It.

See more Code Snippet, jQuery