It's a fairly common practice for webmasters to rel=nofollow
external links, and I frequently see it done with jQuery. The script typically looks something like this (off the cuff here):
jQuery(function($) {
$('a[href^="http://"]').not('a[href*=mydomain]').attr({
'target' : '_blank',
'rel' : 'nofollow'
});
});
Essentially jQuery crawls the DOM, finds every link with an HREF, and if it's not part of "mydomain" appends target="_blank"
and rel="nofollow"
- works a treat, right?
There's just one problem.
It is my understanding that Google and other search engines read the original source and generally ignore the JavaScript, except to penalize Spam tactics or attempt to decipher some limited AJAX.
So I've got to ask - this is a neat little script, but does it even work? If not, then I should go back and execute this sort of thing in PHP before the page is rendered.
Thanks in advance for sharing your knowledge.