Open link in new tab button for non-coders

Yes, I had a rather old script in place for this, but some Stackoverflowing brought me to a new much more elegant solution:

$('a').each(function() {
  if(this.host !== window.location.host) {
    $(this).attr('target', '_blank');
  }
});
1 Like