在状态栏隐藏网址

在状态栏隐藏网址

问题描述:

我读过很多次人们已经问过这个问题了,我找到了答案,虽然我必须手动为我博客中的所有链接做。但是我偶然发现了我无法工作的格式:

I've read that people have asked this question many times and I have found an answer for it, although I had to do it manually for ALL links in my blog. But I'm stumbled with the format that I can't get to work:

我使用的格式:

<a onclick='location.href="#"' style='cursor: pointer;'target='_blank'>

但是我无法让它为数据工作:post.href,它不会打开完全没有。

but I can't get it to work for data:post.href, it won't open at all.

<a onclick='location.href="data:post.href"' style='cursor: pointer;' target='_blank'>

任何人都可以帮我这个吗?在此先感谢

Can anyone please help me with this? Thanks in advance

一般情况下,不建议在SEO中使用href链接。 Google的抓取工具依赖链接中的href来抓取网站,并使用标记中的href链接果汁传递。为了使您的网站在搜索结果中排名更高,您需要href为GoogleBot提供树状结构。

In general, not having a href link in the is not recommended for SEO reasons. Google's crawler relies on the the href in the links to crawl the site, and link juice passes on using the href in the tag. For your site to rank better in the search results, you will need to href to supply the tree structure for GoogleBot.

为防止复制,我建议您使用一些jQuery来隐藏href标签。它利用javascript删除href标签。点击链接,它将打开一个带有href位置的新窗口。

To prevent copying I suggest you use a little of jQuery to hide the href tags. It utilises javascript to remove the href tags. On click of the links, it will open a new window with the href location.

示例如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
    <script>
        $(function(){
            $("a.hidelink").each(function (index, element){
                var href = $(this).attr("href");
                $(this).attr("hiddenhref", href);
                $(this).removeAttr("href");
            });
            $("a.hidelink").click(function(){
                url = $(this).attr("hiddenhref");
                window.open(url, '_blank');
            })
        });
    </script>
    <style>
        a.hidelink {
            cursor: pointer;
            text-decoration: underline;
        }
    </style>
</head>
<body>
<a class="hidelink" href="http://www.google.com">Some Link</a>
</body>
</html>