Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Possible Duplicate:
Does the Google spider render JavaScript?

This a SEO related question, not a code related one.

Googles own link cleaning / cloaking

Gå to http://www.google.com and search for something.

  1. Hover the title and you will se a link to the page you want to go to.
  2. The URL you see when hovering is NOT the link you are clicking on.
  3. Instead of clicking you can drag the title a little bit and then hover it. Then you will se the real URL.

My own link cleaning / cloaking

  1. Go to http://jsfiddle.net/NvmER/1/ and click the link, or look at the code below.
  2. You will be "redirected" to http://www.test.com.
  3. The real link are http://www.test.com/?event=23

Working code in case jsfiddle don't work

If you need to se how it works I pasted a code below.

<a class="direct" href="http://www.test.com/?event=23" data-redirect="http://www.test.com">Länk</a>​

$(document).ready(function() {
    $("a.direct").live("mousedown", function(e){
        var oldurl = $(this).attr('href');
        var newurl = $(this).attr('data-redirect');
        $(this).attr('href', newurl);
    });
});​

Question

Is this ok with Google? It's done with javascript.

If you have an answer, link to a source or test to support it.

share|improve this question

marked as duplicate by John Conde Nov 29 '12 at 13:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Are you querying as to whether Google would be able to see the true target of the link (as @JohnConde has answered), or whether your site could be actively penalised for adopting this, possibly deceptive, linking technique? –  w3d Nov 29 '12 at 16:10
    
Just wondering... how is this different to registering a click event that sets location.href, overriding the default action? What is the intention of doing this? –  w3d Nov 29 '12 at 16:35
    
@w3d 1. I want to know if this might have a negative impact in Google ranking. It does not matter what Google sees in my case. 2. I don't use location.href because I have had issues with open the links in new tabs with middle click. Therefor I use the Google way of doing it by changing the href before the click is fired. 3. My intensions are NOT to trick Google or users. It's just a way to show where the links go without alot of get variables in the way. –  Jens Törnell Nov 30 '12 at 14:23

1 Answer 1

It's hard to say for sure but the answer is probably no. As a general rule search engines don't parse and run JavaScript which makes it not SE-friendly. However, that is slowly changing as they have started to run some JavaScript. Now what they are able to run and what they don't is unknown. So if SEO is a priority then you have to assume they cannot follow these links.

share|improve this answer

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