Forums Forums White Hat SEO Do <a> tags that have event.preventDefault() get indexed?

  • Do <a> tags that have event.preventDefault() get indexed?

    Posted by seohelper on May 7, 2020 at 1:59 pm

    I have a dropdown from which you select values and based on that I generate link and send users to different pages in my website. However since linking this way uses javascript (as well as http requests) it does not get indexed by googles crawlbot.

    I wanted to bypass this by displaying the items in my dropdown as an <a> tag and preventing the actual linking functionality by using event.preventDefault(). Will these links still get crawled?

    step_hane replied 5 years, 7 months ago 1 Member · 2 Replies
  • 2 Replies
  • step_hane

    Guest
    May 7, 2020 at 2:56 pm

    Can you make a sitemap?

  • Centime

    Guest
    May 7, 2020 at 4:21 pm

    I had a similar situation in a list of filter options (they updated the products list in ajax). So they were <a>’s with preventDefault, and google was perfectly fine crawling them.

    In my situation it wasn’t the desired outcome though, since the combination of all those filters resulted in hundreds of thousands of meaningless pages, so I added a rule in robots.txt to stop that.

    You plan should work as expected.

    u/step_hane is right also, be sure to add your pages in your sitemap.

Log in to reply.