[solved] External links, set default target as "_blank"

Works in IE and Chrome:

  function fixExternalLinks() {
    var nodes = document.querySelectorAll('.wikiexternallink a');
    for(var i=0; i< nodes.length; i++){
      var link = nodes[i];
      if (link.hasAttribute('target') == false)  {
        link.setAttribute('target', '_blank');
      }
    }
  }
  document.addEventListener("DOMContentLoaded", fixExternalLinks);
1 Like