<a href="###" rel="external">link</a>
<script type="text/javascript">
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;
</script>
I never understood why this isn't part of Strict. It's fairly common to want to open another window for legitimate reasons - eg. to view a PDF.
I've had this before and I made the decision to downgrade to Transitional, although that little bit of jQ is quite an elegant way of doing it.
Well the usual reason is that it takes choice away from the user; it's the user's prerogative to open links in new windows/tabs, rather than the website's. What if I want to open the PDF in the same window? There'd be no way of doing so if this behaviour is enforced.