Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do modern web crawlers use the click event or navigate directly to href on anchor tags?

I'm building a web site that I want to behave fancy-like for users, but want web crawlers to still be able to navigate properly.

I have the following anchor tag:

<a class="overrideClick" href="/projects">Projects</a>

With the following jQuery:

$(document).on('click', '.overrideClick', function(e) { 
    e.preventDefault(); 
    ( ... ) 
});

Will this kill SEO or can I expect Google/Bing/etc to act as I'm hoping and follow to /projects? I would assume they've historically just used the href value, but I know Google is evaluating some JavaScript now.

I know I could just not-include the js for crawler clients but it'd be interesting to know. For science...

like image 747
Mike Gwilt Avatar asked Aug 19 '12 21:08

Mike Gwilt


2 Answers

I'm fairly certain that erring on the side of having a URL in your href and overriding behavior in script is the correct way to do it. This way if a bot can't execute JS they still navigate to your page. If they can, they see whatever new content you load (assuming you're loading content relevant to both your base link href and your link text).

like image 90
Jason Avatar answered Nov 04 '22 04:11

Jason


I think this link will be useful for you. It appears that Google does take Javascript hyperlinks into acccount.

like image 42
Roozbehan Avatar answered Nov 04 '22 06:11

Roozbehan