0

I have the following on my page:

<a href="javascript:void(0)" onclick="doCheck('test'); return false;" class="btn">Test</a>

It works great but now I'm wondering what will happen when it is seen by a search engine. Will the search engine try to click the address and follow it?

john wagner
  • 751
  • 1
  • 7
  • 8

1 Answers1

0

Google will just ignore it.

It's bad practice to use onClick in that way though, and using the void statement is pretty horrible too.

Have a look at Why is using onClick() in HTML a bad practice? for an explanation of why.

Community
  • 1
  • 1
Rich Bradshaw
  • 71,795
  • 44
  • 182
  • 241
  • That is not exactly true, the Googlebot has basic ability to execute JavaScript. So while I totally agree that it is a horribly bad practice, if Googlebot doesn't yet have the ability to do this they will in the future. – Nick Berardi May 11 '11 at 12:57
  • This particular link will be ignored, if my assumptions about it running some check and updating a small section of the page are correct. – Rich Bradshaw May 11 '11 at 12:59
  • You are right if it doesn't redirect, but if it does then Google might use it. The user really didn't specify, so it is up in the air I guess. – Nick Berardi May 11 '11 at 13:11