DevManX
DevManX

Reputation: 486

Do search engines see clickable divs as links

I am developing a new website, and I would like to use clickable divs instead of normal links:

Here is the code I use:

 <div class="css-class" onclick="location.href='http://example.com/page'" title="Some text">
Some clickable content
</div>

Will Google and other search engines see the clickable divs as well as they see the normal links? In other words, will they be cabable of crawling the http://example.com/page page?

Upvotes: 2

Views: 1110

Answers (3)

Nadeem Haddadeen
Nadeem Haddadeen

Reputation: 469

Google can index the OnClick tag, but if you added a function (external file) to redirect you, here Google can't index it.

Example: Indexed by Google:

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

Not indexed by Google:

<a href="#" onclick="function();">click me</a>

Upvotes: 1

Sanjay Singh
Sanjay Singh

Reputation: 21

Will Google and other search engines see the clickable divs as well as they see the normal links? Yes Google can easily crawl your answer if they are on or without .

Upvotes: 2

Dave
Dave

Reputation: 29141

According to this page:

Since 2009 Google looks for and finds OnClick links in any and all HTML tags. When found they will add the URL to their crawl.

If there is sensible "anchor" text then the text of the element will be used as anchor text.

The OnClick link also passes PageRank.

It then goes on to mention that other search engines aren't yet doing it. (it was written in Oct 2014)

Upvotes: 5

Related Questions