Changes for page How to open external links in a new tab/window by default?
Last modified by Vincent Massol on 2020/04/24
From version 3.1
edited by Gunter Ohrner
on 2019/06/26
on 2019/06/26
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. GOhrner1 +XWiki.Ryan
- FAQCode.FAQClass[0]
-
- answer
-
... ... @@ -1,6 +1,6 @@ 1 1 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: 2 2 3 -1. Create a new page, or go to an existing page that won’t be removed 3 +1. Create a new page, or go to an existing page that won’t be removed. 4 4 1. Click //Edit// and select //Objects//. 5 5 1. In the //Select a Class// box, select //JavaScriptExtension// and click the //Add// button. 6 6 1. In the object that just appeared, enter the following code into the //Code// box: ... ... @@ -14,7 +14,8 @@ 14 14 } 15 15 } 16 16 } 17 +document.addEventListener("DOMContentLoaded", fixExternalLinks); 17 17 {{/code}}))) 18 18 1. Set //Use this extension// to //On this wiki//. 19 19 20 -Thanks to [[laurin1>>https://forum.xwiki.org/u/laurin1]] for this [[solution>>https://forum.xwiki.org/t/solved-external-links-set-default-target-as--blank/2583/21]]. 21 +Thanks to [[pdwalker>>https://forum.xwiki.org/u/pdwalker]] and [[laurin1>>https://forum.xwiki.org/u/laurin1]] for this [[solution>>https://forum.xwiki.org/t/solved-external-links-set-default-target-as--blank/2583/21]].