From version < 3.1 >
edited by Gunter Ohrner
on 2019/06/26
To version < 4.1 >
edited by Gunter Ohrner
on 2019/06/26
< >
Change comment: There is no comment for this version



... ... @@ -17,4 +17,4 @@
17 17  {{/code}})))
18 18  1. Set //Use this extension// to //On this wiki//.
19 19  
20 -Thanks to [[laurin1>>]] for this [[solution>>]].
20 +Thanks to [[pdwalker>>]] and [[laurin1>>]] for this [[solution>>]].

In order to configure all external links to open in new tabs / windows automatically, i.e. to use the link target "_blank" from an HTML point of view, you have to add some JavaScript to your XWiki:

  1. Create a new page, or go to an existing page that won’t be removed
  2. Click Edit and select Objects.
  3. In the Select a Class box, select JavaScriptExtension and click the Add button.
  4. In the object that just appeared, enter the following code into the Code box:
    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');
  5. Set Use this extension to On this wiki.

Thanks to laurin1 for this solution.

Thanks to pdwalker and laurin1 for this solution.

Get Connected