0

It's been about 5 years since google indexing javascript and I'm still confused about details.

I read here ( Does Google perform onClick actions? ) basics. And then I know that javascript created links is indexed perfectly, and that rel="nofollow" added by javascript it's not working because it's too late.

But some more complicated task: What happend when I create something like this:

<a href="/first" onclick="return !(location.href='/second')">…</a>

than Googlebot will index only first link, only second link, or both of them?

and

<a href="/first" onclick="return !(location.href='/second')" rel="nofollow">…</a>

will this index second link?

  • 1
    Overriding link behavior for visitors with JavaScript could be considered cloaking and get you banned from search engines. If you do intercept the onclick for visitors, you should ensure that the end result is the same as clicking, even if the path taken to get there is faster or different. – Stephen Ostermiller Jun 10 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.