I want visitors to be able to click on (or copy) an email address directly on my webpage. However, if I could make it (a little bit) harder for bots and other crawlers to get said email address and register it in a spam list, it would be awesome.
我希望访问者能够在我的网页上直接点击(或复制)一个电子邮件地址。但是,如果我能让机器人和其他爬虫程序(有点)更难获得说的电子邮件地址并在垃圾邮件列表中注册它,那就太棒了。
I found different ways of doing this (i.e. encoding mailto HTML links), either with JavaScript or in pure HTML, but what do you guys recommend ? The JavaScript techniques seem more complicated, but this may potentially affect users that have it turned off, and legit crawlers like Google.
我找到了不同的方法(比如用JavaScript或纯HTML编码mailto HTML链接),但是你们有什么推荐吗?JavaScript技术似乎更复杂,但这可能会影响关闭它的用户,并使其合法运行,比如谷歌。
On the other hand, the HTML one seems a bit basic, the bot writers should have figured it out by now...
另一方面,HTML似乎有点基础,机器人作者现在应该知道了……
Should I bother at all doing this, or will the spammers get my email anyway ? I know that antispam filters are getting better and better, but if I can do something more to slow spammers down, I will.
我应该费心去做这些,还是垃圾邮件发送者会收到我的邮件?我知道反垃圾邮件过滤器正在变得越来越好,但是如果我能做更多的事情来减缓垃圾邮件发送者的速度,我会。
6 个解决方案
#1
35
JavaScript remains one of the best mailto obfuscator. For users with JavaScript disabled you may want to substitute the mailto link with a link to a contact form.
JavaScript仍然是最好的mailto模糊器之一。对于禁用了JavaScript的用户,您可能希望用一个到联系人表单的链接替换mailto链接。
The following is a popular JavaScript anti spam email obfuscator:
下面是一个流行的JavaScript反垃圾邮件混淆器:
- http://www.jottings.com/obfuscator/
- http://www.jottings.com/obfuscator/
There is also a php version of the above to be able to generate obfuscated emails from the server side.
上面还有一个php版本,可以从服务器端生成混乱的电子邮件。
This is the JavaScript code that the above tool would generate to obfuscate my email address (comments intact):
这是上面的工具会生成的JavaScript代码来混淆我的电子邮件地址(完整的注释):
<script type="text/javascript" language="javascript">
<!--
// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption key feature by Andrew Moulden, Site Engineering Ltd
// This code is freeware provided these four comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/
{ coded = "lMnK@wMunFK8MDDMKKt.ktl"
key = "1DtzZ8TGBuhRjJMKWI4gkUF2qidfOyPmSN7X30Vpso6xvErLnwQCbalA95HcYe"
shift=coded.length
link=""
for (i=0; i<coded.length; i++) {
if (key.indexOf(coded.charAt(i))==-1) {
ltr = coded.charAt(i)
link += (ltr)
}
else {
ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
link += (key.charAt(ltr))
}
}
document.write("<a href='mailto:"+link+"'>Email Me</a>")
}
//-->
</script><noscript><a href='contact-form.html'>Email Me</a></noscript>
#2
10
You could use the reCAPTCHA Mailhide functionality. This will render email addresses on the form use...@domain.tld
where the ellipsis is a link to view the full address. It is a little cumbersome for the visitor but should give premium protection. Having said that, this technique will not let your visitors copy the address directly from your webpage.
您可以使用reCAPTCHA Mailhide功能。这将使电子邮件地址在表单使用…@domain。在tld中,省略号是查看完整地址的链接。这对游客来说有点麻烦,但应该提供额外的保护。话虽如此,这种技术不会让你的访问者直接从你的网页复制地址。
I don't get the part about the "legit crawlers" like Google. At least, I am unable to see why Google should index the email address anyway. (See OPs comment below.)
我不理解谷歌这样的“合法爬虫”。至少,我不明白谷歌为什么要索引电子邮件地址。(见下面的行动发表评论。)
#3
6
This looks like a really cool method that encodes the characters, which I assume would defeat basic spam bots:
这看起来是一个非常酷的编码字符的方法,我认为它将打败基本的垃圾邮件机器人:
http://robspangler.com/blog/encrypt-mailto-links-to-stop-email-spam/
http://robspangler.com/blog/encrypt-mailto-links-to-stop-email-spam/
So
所以
<a href="mailto:test@test.com">Email</a>
becomes
就变成了
<a href="mailto:test@test.com">Email</a>
It's appealing in that it doesn't require any Javascript.
它的吸引力在于它不需要任何Javascript。
恰好例子。
#4
2
You can use external services like aemail.com:
你可以使用aemail.com这样的外部服务:
@email is a free e-mail hiding service that hides emails using short URLs redirecting senders to the mailto-url after clicking the link.
@email是一个免费的电子邮件隐藏服务,它使用短url隐藏电子邮件,在点击链接后将发送者重定向到邮件地址。
After entering an email at aemail.com, you will get a short URL, which can be used to replace your 'mailto' link. Once link is clicked, your user will be redirected to the 'mailto' URL without any notice of the aemail.com. API can be used to hide emails/get URLs dynamically.
在aemail.com上输入电子邮件后,你会得到一个简短的URL,可以用来取代你的“mailto”链接。一旦链接被点击,你的用户就会被重定向到“mailto”URL,而不会收到任何aemail.com的通知。API可用于动态隐藏电子邮件/获取url。
Example:
例子:
<a href="mailto:info@itee.com">Contact</a>
< a href = " mailto:info@itee.com " >与< / >
Replaced With
取而代之的是
<a href="https://aemail.com/q2">Contact</a>
< a href = " https://aemail.com/q2 " >与< / >
Will Keep Email Link Working.
将保持电子邮件链接工作。
#5
1
I simply use:
我只是使用:
<script language="javascript" type="text/javascript">
var pre = "hideme";
document.write("<a href='mailto:" + pre + "@domain.com'>" + pre
+ "@domain.com</a>");
</script>
<noscript>Enable javascript to see our email!</noscript>
#6
1
Building on Daniel Vassallo's answer, one way to encrypt a mailto link that may avoid cleverer spambots that will evaluate JS document.write
s (as pointed out by incarnate) would be to put the decryption in a Javascript function that is only evaluated when the link is clicked on. For example, using base64 as the "encryption":
以Daniel Vassallo的回答为基础,一种加密mailto链接的方法,可以避免更聪明的垃圾邮件机器人来评估JS文档。写入(如incarnate所指出的)将是将解密放在一个Javascript函数中,该函数只在单击链接时进行计算。例如,使用base64作为“加密”:
<script>
function decryptEmail(encoded) {
var address = atob(encoded);
window.location.href = "mailto:" + address;
}
</script>
<a href="javascript:decryptEmail('dGVzdEB0ZXN0LmNvbQ==');">Email</a>
砰砰作响。
I don't claim to know whether this could or could not be outsmarted by a more sophisticated crawler.
我不知道这是否会被更复杂的爬虫所打败。
#1
35
JavaScript remains one of the best mailto obfuscator. For users with JavaScript disabled you may want to substitute the mailto link with a link to a contact form.
JavaScript仍然是最好的mailto模糊器之一。对于禁用了JavaScript的用户,您可能希望用一个到联系人表单的链接替换mailto链接。
The following is a popular JavaScript anti spam email obfuscator:
下面是一个流行的JavaScript反垃圾邮件混淆器:
- http://www.jottings.com/obfuscator/
- http://www.jottings.com/obfuscator/
There is also a php version of the above to be able to generate obfuscated emails from the server side.
上面还有一个php版本,可以从服务器端生成混乱的电子邮件。
This is the JavaScript code that the above tool would generate to obfuscate my email address (comments intact):
这是上面的工具会生成的JavaScript代码来混淆我的电子邮件地址(完整的注释):
<script type="text/javascript" language="javascript">
<!--
// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption key feature by Andrew Moulden, Site Engineering Ltd
// This code is freeware provided these four comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/
{ coded = "lMnK@wMunFK8MDDMKKt.ktl"
key = "1DtzZ8TGBuhRjJMKWI4gkUF2qidfOyPmSN7X30Vpso6xvErLnwQCbalA95HcYe"
shift=coded.length
link=""
for (i=0; i<coded.length; i++) {
if (key.indexOf(coded.charAt(i))==-1) {
ltr = coded.charAt(i)
link += (ltr)
}
else {
ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
link += (key.charAt(ltr))
}
}
document.write("<a href='mailto:"+link+"'>Email Me</a>")
}
//-->
</script><noscript><a href='contact-form.html'>Email Me</a></noscript>
#2
10
You could use the reCAPTCHA Mailhide functionality. This will render email addresses on the form use...@domain.tld
where the ellipsis is a link to view the full address. It is a little cumbersome for the visitor but should give premium protection. Having said that, this technique will not let your visitors copy the address directly from your webpage.
您可以使用reCAPTCHA Mailhide功能。这将使电子邮件地址在表单使用…@domain。在tld中,省略号是查看完整地址的链接。这对游客来说有点麻烦,但应该提供额外的保护。话虽如此,这种技术不会让你的访问者直接从你的网页复制地址。
I don't get the part about the "legit crawlers" like Google. At least, I am unable to see why Google should index the email address anyway. (See OPs comment below.)
我不理解谷歌这样的“合法爬虫”。至少,我不明白谷歌为什么要索引电子邮件地址。(见下面的行动发表评论。)
#3
6
This looks like a really cool method that encodes the characters, which I assume would defeat basic spam bots:
这看起来是一个非常酷的编码字符的方法,我认为它将打败基本的垃圾邮件机器人:
http://robspangler.com/blog/encrypt-mailto-links-to-stop-email-spam/
http://robspangler.com/blog/encrypt-mailto-links-to-stop-email-spam/
So
所以
<a href="mailto:test@test.com">Email</a>
becomes
就变成了
<a href="mailto:test@test.com">Email</a>
It's appealing in that it doesn't require any Javascript.
它的吸引力在于它不需要任何Javascript。
恰好例子。
#4
2
You can use external services like aemail.com:
你可以使用aemail.com这样的外部服务:
@email is a free e-mail hiding service that hides emails using short URLs redirecting senders to the mailto-url after clicking the link.
@email是一个免费的电子邮件隐藏服务,它使用短url隐藏电子邮件,在点击链接后将发送者重定向到邮件地址。
After entering an email at aemail.com, you will get a short URL, which can be used to replace your 'mailto' link. Once link is clicked, your user will be redirected to the 'mailto' URL without any notice of the aemail.com. API can be used to hide emails/get URLs dynamically.
在aemail.com上输入电子邮件后,你会得到一个简短的URL,可以用来取代你的“mailto”链接。一旦链接被点击,你的用户就会被重定向到“mailto”URL,而不会收到任何aemail.com的通知。API可用于动态隐藏电子邮件/获取url。
Example:
例子:
<a href="mailto:info@itee.com">Contact</a>
< a href = " mailto:info@itee.com " >与< / >
Replaced With
取而代之的是
<a href="https://aemail.com/q2">Contact</a>
< a href = " https://aemail.com/q2 " >与< / >
Will Keep Email Link Working.
将保持电子邮件链接工作。
#5
1
I simply use:
我只是使用:
<script language="javascript" type="text/javascript">
var pre = "hideme";
document.write("<a href='mailto:" + pre + "@domain.com'>" + pre
+ "@domain.com</a>");
</script>
<noscript>Enable javascript to see our email!</noscript>
#6
1
Building on Daniel Vassallo's answer, one way to encrypt a mailto link that may avoid cleverer spambots that will evaluate JS document.write
s (as pointed out by incarnate) would be to put the decryption in a Javascript function that is only evaluated when the link is clicked on. For example, using base64 as the "encryption":
以Daniel Vassallo的回答为基础,一种加密mailto链接的方法,可以避免更聪明的垃圾邮件机器人来评估JS文档。写入(如incarnate所指出的)将是将解密放在一个Javascript函数中,该函数只在单击链接时进行计算。例如,使用base64作为“加密”:
<script>
function decryptEmail(encoded) {
var address = atob(encoded);
window.location.href = "mailto:" + address;
}
</script>
<a href="javascript:decryptEmail('dGVzdEB0ZXN0LmNvbQ==');">Email</a>
砰砰作响。
I don't claim to know whether this could or could not be outsmarted by a more sophisticated crawler.
我不知道这是否会被更复杂的爬虫所打败。