Add target=_blank automatically to external links and more
jQuery(document).ready(function () {
jQuery.expr[':'].external = function (obj) {
var isBlank = false;
if (!obj.href.match(/^mailto:/) && (obj.hostname != location.hostname) && !obj.href.match(/^javascript:/) && !obj.href.match(/^javascript:/) && !obj.href.match(/^$/)) {
isBlank = true;
}
if (obj.href.match(/.[pP][dD][fF]$/)) {
//PDFs
isBlank = true;
}
return isBlank;
};
jQuery('a:external').attr('target', '_blank');
});
by Chris Pratt