How to make all external links open in a new window
First, you have to look in blog.xsl and static.xsl if the xsl:import elements are in the following order
<xsl:import href="../standard/common.xsl"/>
<xsl:import href="master.xsl"/>
(common.xsl has to be before master.xsl)
In "old" standard xsl templates it was the other way round, we changed that now as it makes more sense this way.
Then, open up master.xsl and add the following template (for example just before the closing </xsl:stylesheet>)
<xsl:template match="xhtml:a[@href and not(@target)]" mode="xhtml">
<a>
<xsl:apply-templates select="@*" mode="xhtml"/>
<xsl:if test="starts-with(@href,'http:')">
<xsl:attribute name="target">_blank</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="xhtml"/>
</a>
</xsl:template>
Now, all external links (those who start with http
get a target="_blank" attribute within static and blog pages
(from http://forum.freeflux.net/index.php?t=msg&goto=1224 )
Add Comment