skip to Main Content

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?

3

Answers


  1. 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)

    Login or Signup to reply.
  2. 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 .

    Login or Signup to reply.
  3. 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>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search