Mobile app version of vmapp.org
Login or Join
Jamie184

: Does a jQuery "rel=nofollow" even work? 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

@Jamie184

Posted in: #Googlebot #Nofollow #Seo

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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Jamie184

1 Comments

Sorted by latest first Latest Oldest Best

 

@Kevin317

Google does process JavaScript now so, at least for them, this should be effective. But if you want to be sure this works for all search engines you should implement a solution server-side.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme