10

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

Mike Gwilt
  • 2,399
  • 1
  • 16
  • 14

4 Answers4

6

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

Jason
  • 51,583
  • 38
  • 133
  • 185
2

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

Roozbehan
  • 478
  • 5
  • 15
1

"Use a text browser such as Lynx to examine your site, because most search engine spiders see your site much as Lynx would. If fancy features such as JavaScript, cookies, session IDs, frames, DHTML, or Flash keep you from seeing all of your site in a text browser, then search engine spiders may have trouble crawling your site."

http://support.google.com/webmasters/bin/answer.py?hl=en&answer=35769

All of them I have ever seen only analyze the markup to determine ref's because they typically take these addresses out and pass them to other distributed agents for processing. I know there are very few now that will look at javascript but if you just include href in all of them you will get it for both.

Joe
  • 11
  • 1
0

Seems that Google bot doesn't like e.preventDefault().

I have a page which opens some anchors in a jQuery UI Dialog. This anchors or the content behind the anchors are never indexed so I think Google bot stops on e.preventDefault().

Someone got a idea how to solve this? I'll try if return false will do it.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Mattew
  • 23
  • 3