在状态栏隐藏网址 [英] hide url at status bar

查看:91
本文介绍了在状态栏隐藏网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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>

这篇关于在状态栏隐藏网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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