JavaScript links now pass PageRank and anchor text

  • 0
  • June 2, 2009
Patrick Altoft

Patrick Altoft

Director of Strategy

Last week Google made a few announcements at the Google I/O conference and one major one seems to have gone unnoticed.

A lot of people have suspected that Google is crawling JavaScript for some time but due to the random nature of it nobody has done extensive testing to prove either way. Testing this sort of thing is a waste of time because Google has different crawling rules for different sites and whatever is true today probably won’t be true tomorrow.

The changes were revealed by Vanessa Fox and are based around the way Google handles non-standard web links.

Googlebot is now able to construct much of the page and can access the onClick event contained in most tags. For now, if the onClick event calls a function that then constructs the URL, Googlebot can only interpret it if the function is part of the page (rather than in an external script).

Some examples of code that Googlebot can now execute include:

  • <div onclick="document.location.href=''">
  • <tr onclick="myfunction('index.html')"><a href="#" onclick="myfunction()">new page</a>
  • <a href="javascript:void(0)" onclick="'welcome.html')">open new window</a>

These links pass both anchor text and PageRank.

This is welcome news from Google, even if it changes things a bit. With an algorithm built on links there is no reason Google should count some links and discount others just because of the way they are implemented. From a users point of view if you can click on a link then it’s a real link and that’s how Google should see them too.

This change does bring about some interesting issues and I wonder how many sites will suddenly see thousands of new pages being indexed or a massive boost in rankings as links that previously didn’t count are suddenly used by Google.

Google would be wise to make a big announcement regarding this change otherwise webmasters could be tricked into violating Googles link selling guidelines by offering JavaScript links which actually pass PageRank.

*Edit 19/12/17* Despite this announcement many SEO agencies and commentators weren’t confident on whether JavaScript really does pass PageRank and/or anchor text in this way, especially since the way Google reacts to JS seems to be completely hit and miss. We proved in an experiment (a mere 8 years later) that JavaScript links really do pass PageRank.

Free of charge. Unsubscribe anytime.