# Sunday, 05 February 2006
« Send As a Public Folder | Main | Display Referrers »

To have certain links opening in a new window (and to be HTML 4.0 & XHTML 1.0 Strict compliant) use the following procedure:

1.   Create text file "external.js" containing:

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") == "external")
     anchor.target = "_blank";
window.onload = externalLinks;

and save this in a new directory "\scripts"

2.   Edit header secion of "homeTemplate.blogtemplate" to contain:

<script type="text/javascript" src="scripts/external.js"></script>

3.    Using dasBlog's native editor (in HTML section) edit links to be in the following format:

<a href="document.html" rel="external">external link text</a>

For example:

BBC News site in new window


Update Regardless of tab settings, in Firefox links always seem to want to open in the same tab. The only way to force them to open in a new tab is to include the javascript in the document rather than a link to an external .js file.
Sunday, 05 February 2006 13:45:18 (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |  Trackback Related posts:
Cannot post large attachments to dasBlog
Embed .PDFs in HTML Pages
Display Referrers
Congratulations, you've installed dasBlog!