从Google索引编制防止URL形成JavaScript数组 [英] Prevent URLs form JavaScript array from Google indexation

查看:149
本文介绍了从Google索引编制防止URL形成JavaScript数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一些广告。此广告是图片,未在< a> 标记中关闭。我将广告URL存储在JS数组广告中。当用户点击广告时,执行下一个JS代码:

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');
    });

但我认为谷歌在任何情况下都会索引此类网址。如何防止此类网址被Google索引编制?

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

robots.txt 等解决方案< META NAME =ROBOTSCONTENT =NOINDEX,NOFOLLOW> 是不可接受的,因为网址列表是动态的,我在网页上有其他网址必须由Google编制索引。

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.

推荐答案

您可以尝试在base64中对uri进行编码,并在将它们添加到页面时对其进行解码:

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

您可以使用btoa解码基本64字符串,atob进行编码。

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');
});

这篇关于从Google索引编制防止URL形成JavaScript数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆