I have the following (jquery) selector looking for external links.
This works, and ignores all links that include location.hostname
(e.g. www.domain.com)
My question is, how to extend this to also ignore links to subdomains of your site? (e.g. new.domain.com)
$('a').each(function() {
var href = $(this).attr('href');
if(this.hostname && this.hostname !== location.hostname)
{
$(this)
.removeAttr('target')
.attr('rel', 'external')
.attr('title', href)
.click(function() {
window.open($(this).attr('href'));
return false;
});
}
});