|
ExternalLinksInNewWindowNote: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.
QuestionHow can I configure external links to always open in a new window? AnswerAdd the following to config.php: DiscussionThe Contributors
(more semantic) AlternativeYou could use in config.php. Then put function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "extern")
anchor.target = "_blank";
}
}
window.onload = externalLinks;
into a file - say - 'extern.js'. Adding <script type='text/javascript' src='PATH/extern.js'></script> to your template will call the script on pageload. For more on this - nicer - solution have a look at New-Window Links in a Standards-Compliant World(approve links). pmwiki-2.2.0-beta68 -- Last modified by {{gunter}}?
|