954,124 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Does google understand javascript?

I know that spiders are incapable of filling out forms and the like. But if I have links that have been dynamically generated client-side by some simple javascript, are they capable of following these links?

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

Yes it does. From what I hear it prefers if the javascript has the actual URL that it wil be landing on

window.location("http://www.mcpmedia.com");


and it doesn't read it if it is inside a select box. It really much prefers a good text link to anything else tho. http://www.highrankings.com/forum/index.php?showtopic=6735&hl=javascript+link

Arizona Web
Junior Poster
118 posts since Jun 2004
Reputation Points: 16
Solved Threads: 2
 

Unfortunately that is not good news for me. The code I had in mind was the "featured threads" listing in the sidebar of my forum index. It uses http://www.daniweb.com/techtalkforums/external.php?type=js

<script src="external.php?type=js" type="text/javascript"></script>
<script type="text/javascript">
<!--
for (i=0;i<10;i++)
{
  document.writeln("<div class=\"smallfont\" style=\"padding:8px\">" + threads[i].threaddate + " " + threads[i].threadtime + "<strong><a href=\"thread" + threads[i].threadid + ".html\">" + threads[i].title + "</a></strong>" + threads[i].poster + "</div>");
}
//-->
</script>


According to the link you sent me, google is experimenting with a spider that can follow simple JavaScript that clearly contains the URL only. Oh well.

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

On a positive note, I think I cought wind that it is also experimenting with a bot that can read javascript write stuff too. But I wouldn't bet the farm on it.

That looks like something you could do with PHP tho.

Arizona Web
Junior Poster
118 posts since Jun 2004
Reputation Points: 16
Solved Threads: 2
 

That would be nice. In the meantime, I have added tags.

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You