All good web developers now design sites using the XHTML Strict DTD. Strict XHTML forbids the use of the target="_blank" attribute on anchors, used to open a link in anew browser window. The reason for this is that there should be a separation between presentation and behaviour.
This is all fine and dandy until your customer requests that all links to external sites open in a new browser window. This is not an unreasonable request.
The answer is to add an an event to such links using Javascript. As a fan of jQuery, this could not be easier.
Step 1. Add a rel attribute to all external links/anchors
e.g.
<a href="externalsite.com" rel="external" />
Step 2. Include the following jQuery script
$('a[rel=external]').attr('target', '_blank');
If adding the target attribute seems like a hack, then the following should achieve the same goal
$('a[rel=external]').click(function(){window.open(this.href);
return false;
This may all seem a bit obvious, but I’m sure there’s someone out there looking for an elegant fix like this.

“All good web developers now design sites using the XHTML Strict DTD.”
That’s a gross overstatement. Consider these two “good” web developers, for example: Roger Johansson and Ian Hickson. Perhaps a more fair claim would be “most good web developers now design sites using a strict DTD.”
very nice.
also i think you need an exact number for developers who use xhtml strict, a list of all good web developers, and a definition of “good” and “developers” translated into klingon (just in case).
Thanks for sharing,
However, this breaks on links with other information in the rel=”" attribute (such as rel=”nofollow”)
rel=”nofollow external” is no good.
[...] first solution I came across used jQuery to find external links with the rel="external" attribute and add a [...]
This little snippet saved my bacon. Awesome, awesome work. Thanks for sharing.