我希望我的页面/帖子上显示的电子邮件不会被机器人程序/垃圾邮件发送者阅读/使用。例如,我可以使用一些插件,将“@”替换为“[在]”等等,但在这种情况下,我不再能够自动使用mailto,例如:
<a href="javascript:void(0)" target="_blank" onclick="window.open(\'https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=somemail@somedomain.com\',\'Compose new message\',\'width=640,height=480\')" rel="noreferrer">somemail@somedomain.com</a>
你能推荐一个适用于这种情况的插件吗?(保持电子邮件地址正常显示,但防止机器人读取?)
谢谢
SO网友:Wyck
垃圾邮件预防应该在电子邮件服务器端完成,我的意思是你不应该因为垃圾邮件而破坏你的可用性,相反,你应该在你的电子邮件端使用适当的垃圾邮件阻止或过滤服务。例如,我多年来一直在使用Postini,几乎没有垃圾邮件需要处理。
另一种防止编写糟糕的机器人程序的方法是使用ascii或JavaScript的简单编码电子邮件,这样机器人程序可以读取源代码,这是无用的,但用户仍然可以看到一个有效的可点击链接,
例如:
**test@example.com**
//becomes in ASCII
<a href="mailto:test@exam
ple.comtest@e
xample.com"></a>
//
//or a javascript example:
<SCRIPT LANGUAGE="javascript">
var first = \'ma\';
var second = \'il\';
var third = \'to:\';
var address = \'test\';
var domain = \'example\';
var ext = \'com\';
document.write(\'<a href="\');
document.write(first+second+third);
document.write(address);
document.write(\'@\');
document.write(domain);
document.write(\'.\');
document.write(ext);
document.write(\'">\');
document.write(\'Click Here to Email Me!</a>\');
</script>
你可以在这里找到发电机,
http://www.ohlone.edu/org/webcenter/emailencoder.html或者在这里
http://www.wbwip.com/wbw/emailencoder.html 还有一些javascript版本,就像这个jQuery版本一样
http://plugins.jquery.com/plugin-tags/email-encode