views:

52

answers:

3

I have seen many websites includes apple and most of asp.net sites uses

<a onclick='s_objectID="http://www.apple.com/mac/_2";return this.s_oc?this.s_oc(e):true'></a>

kind of links. i.e. no href on a tag. and link embedded to onclick event.

what are the reasons for that ? analytics ?

How does it affect on seo ?

+1  A: 

Well in ASP.NET the links that have onclick only defined are LinkButtons - a specially formulated link that causes a postback. I'm not a big fan of it purely for the reason that it creates nasty inline JS. I'm not sure for what purpose Apple uses the links you mentioned.

As for SEO - it all depends on the engine, I know Google do follow some javascript links but not all engines do. In general its best practice (and not only for SEO) to not put inline JavaScript into your links (or any other elements). It is not accessible, it makes your site harder to maintain and its just ugly.

Darko Z
A: 

Some websites will use this technique for analytics. Also, sometimes people will use it to hide the URL when people hover over the link or to customize where the URL goes. Also, it can be used to send extra data along with the URL (ie. the contents of a form). However, this is terrible for search engines when they are crawling your page because they can't figure out where the URL points to and they can't index it.

jake33
A: 

There is some kind of operation in this link. If you loook at the code

return this.s_oc?this.s_oc(e):true

it is enabling and disabling the link. if condition s_oc true, then the link works else link not works. THis will help there own analytic purpose.

btw, in SEO aspect. href is the best visible to Search Engines. As because OnClick execute as Javascript function, Search Engines will not process this.

Muneer
I suspect they might process dynamic links, actually. At least, they certainly have the capability. Don't forget Google currently has the most badass javascript engine on the market.
no
Generally bots are not processing Javascript. Plain HTML are the best and un beatable. Google might have some technology but they do not want to publish themselves as they do so.Follow the below URL to see more about Links and SEhttp://guides.seomoz.org/chapter-4-basics-of-search-engine-friendly-design-and-development#4a
Muneer