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-product
without 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?