Mobile app version of vmapp.org
Login or Join
Yeniel560

: Using preventDefault() to cloak links bad for SEO? I'm thinking of doing something like this: <a href="http://www.example.com" data-href="http://www.affiliatelink.com">Link</a> When a

@Yeniel560

Posted in: #Seo #Url

I'm thinking of doing something like this:

<a href="http://www.example.com" data-href="http://www.affiliatelink.com">Link</a>


When a user hovers the link they will see example.com in the address bar, but when they click it they will be taken to the affiliatelink.com instead.

<script>
$("[data-href]").click(function(event) {
event.preventDefault();
window.location.replace($(this).data('href'));
});
</script>


The affiliate link is for the same site that appears in the users status bar, I'm not tricking users to go to some unrelated site. Is this a quick way to get screwed by Google?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Yeniel560

2 Comments

Sorted by latest first Latest Oldest Best

 

@Angela700

It looks like you're trying to change the destination of the page via javascript. I agree with the answer and comments above. Just don't do this act unless of course you're playing around with javascript on your own private server.

This is how you should make your link:

<a href="example.com">Some link</a>


That's all. No javascript required.

10% popularity Vote Up Vote Down


 

@Connie744

Google has far too many PhDs on their payroll to think that you have one over on them and they haven't thought of this already. They can read your javascript, too. Any attempt to cloak in any way will let you screw yourself and not by Google.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme