2017-06-05 37 views
0

这个JavaScript hack足以掩盖从机器人的mailto链接吗?

// contact link -- no peeking! 
 
    $('.footer a.peek').click(function(){ 
 
    $(this).attr('href', atob('bWFpbHRvOmRvbnRzdGVhbEBtZS5jb20=')); 
 
    }); 
 
    $('.footer a.peek').focusout(function(){ 
 
    $(this).attr('href', '#'); 
 
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 

 
<div class="footer"> 
 
    <a class="peek" href="#">Contact Me</a> 
 
</div>

+0

它肯定会减少机器人的数量,因为大多数仍然不运行JS ... – dandavis

回答

0

这可能会掩盖大多数机器人的链接,是的。

它也将屏蔽从触摸屏设备(如智能手机)的链接 - 没有鼠标光标,他们将永远不会触发mouseenter事件。这可能是不可取的。考虑其他方法。

+0

我更新了片段,完全忘了移动感谢。使用点击事件。 – shwnrgr