If you want to have all links in your document that point to external sites open up in a new window then you’ll realise you can no longer use target=”_blank”… well that’s if you want to conform to XHTML strict. The Jquery Snippet below could solve your problem.
$.expr[':'].external = function(obj)
{
return !obj.href.match(/^mailto\:/) && (obj.hostname != location.hostname);
};
$(document).ready(function() {
$('a:external').attr('target', '_blank');
});