tags:

views:

34

answers:

2

I have a page where in a photo and description link is there, i want replace the hard coded link with a javascript,which will add them,as i dont want the search engine to scroll the links.I dont wanna use "nofollow" attribute.How to code it in js.

+1  A: 

Update: I may have misunderstood you - I thought you want to keep search engine visibility. Can you clarify which one you want? If you don't want the links and images to be indexed, I'd say nofollow is in fact your best friend. A JavaScript based solution is of course doable, but will lock out clients that don't have it enabled.

Original answer

The usual way would be to keep the link in a standard href attribute, and adding a JavaScript onclick event that does its thing using the href, and returns false so the "normal" link doesn't get triggered.

This leaves a search engine-readable link in place, and enables clients with JavaScript disabled to still somehow access the image.

This technique is also known as progressive enhancement.

Pekka
A: 

I would be surprised is Google couldn't handle links created from Javascript. If you want to keep the linked pages unindexed, use nofollow on the link or noindex on the target page or add them to robots.txt.

Tgr