Pergunta

I have some adverts on my site. This adverts are images and not closed in <a> tag. I store adverts URLs in JS array advertisement. When user clicks on advert the next JS code executed:

    $(".jLinkBlank").click(function() {
        var adverId = parseInt($(this).attr('id').substring(5));
        var url = advertisement[adverId];
        window.open(url, '_blank');
    });

But as I see Google indexing such URLs in any case. How can I prevent such URLs from Google indexation?

Solutions like robots.txt or <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> are not acceptable, because URLs list is dynamic and I have other URLs on the pages what must be indexed by Google.

Foi útil?

Solução

You can try to encode your uri in base64 and decode them when adding them to page :

You can use btoa to decode a base 64 string, atob to encode.

$(".jLinkBlank").click(function() {
     var adverId = parseInt($(this).attr('id').substring(5));
    var url = btoa(advertisement[adverId];)
    window.open(url, '_blank');
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top