Mobile app version of vmapp.org
Login or Join
Jamie184

: Seo implication of taking user to some other link rather than href given on anchor through javascript I have the following URLs on a page: <a class="mylink" href="http://www.example.com/old-product1"

@Jamie184

Posted in: #Cloaking #GoogleSearch #Hyperlink #Javascript #Seo

I have the following URLs on a page:

<a class="mylink" href="http://www.example.com/old-product1" />
<a class="mylink" href="http://www.example.com/old-product2" />
<a class="mylink" href="http://www.example.com/old-product3" />


And essentially I want take the user from /old-product to /new-productwithout updating the URLS on the page in the source. I am using the following JavaScript to inject new URLS into the source.

$(".mylink a").each(function(){
$(this).click(function(event){
var urlSplit = $(this).attr('href').split("product");
var pid = urlSplit[urlSplit.length-1];
window.location.href = "http://www.example.com/new-product"+pid;
event.preventDefault()
return false;
});
})


What is the SEO implication of using JavaScript for taking a user from a defined link in href to some other link?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Jamie184

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

It's considered link cloaking, the major search engines will not appreciate this behaviour, nor will users. You should always adopt a transparent links policy, that way you run no risk of annoying your users or being punished by the search engines.

301 Redirects

If you have new pages, new products etc, then the correct method would be to use a 301 redirect from old page, to new page, this way not only do you keep search engines happy, you keep your visitors happy too, assuming that old product, is related to new product.

The other great thing about a 301 redirect is that you don't need to edit code source, simply apply your rules to your .htaccess, or IIS config, and the rest would be done for you. Finally, a 301 redirect will ensure that page rankings are being passed from old to new, while a JavaScript injection most likely won't.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme