-2

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 www.example.com in the address bar, but when they click it they will be taken to the www.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?

  • 1
    This is a dirty trick for users! I often hover over a link to see where it goes first. If you did something like this to me I would be p1ss3d!! Why of God's green earth would you want to do this? What would be the point? To hide links from Google? Are you not proud of who you link to? It sounds to me like you really need to reconsider what you are doing and why. If you feel you need to resort to dirty tricks, then you really should not worry about Google. You have bigger problems. Do understand that Google can run JavaScript and has for many years now. You will not gain anything from this. – closetnoc Apr 8 '15 at 3:48
  • The alternative is to set up a redirect like www.mysite.com/go/example that redirects to www.example.com. OR I can simply just show www.example.com when they hover, that's my idea. This can actually improve user experience. They won't see some crazy long affiliate url, and they are taken to the same site anyway. I'm not talking about tricking users to a different website. – Friday Apr 8 '15 at 4:42
  • Using a redirect script can help. None of my links are particularly long- I can see wanting to simplify a links appearance. As a user I do not care about the link gobblie-gook (technical term) in the actual link as long as it is honest. Most users understand that a cr@p-l0@d of parameters often come with these links. – closetnoc Apr 8 '15 at 4:52
  • For the record- I do not feel like you had bad intentions. You are getting waffle-stomped on this question, but do not let that discourage you. We are here to learn and teach and help each other. – closetnoc Apr 8 '15 at 15:59
4

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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.