我希望访问者能够直接在我的网页上单击(或复制)电子邮件地址。然而,如果我能让机器人和其他爬虫更难获取所述电子邮件地址并将其注册到垃圾邮件列表中,那就太棒了。
我发现了不同的方法来做到这一点(即编码邮件到 HTML 链接),无论是使用 JavaScript 还是纯 HTML,但是你们推荐什么? JavaScript 技术看起来更复杂,但这可能会影响关闭它的用户以及像 Google 这样的合法爬虫。
另一方面,HTML 似乎有点基本,机器人编写者现在应该已经弄清楚了......
我是否应该费心这样做,或者垃圾邮件发送者无论如何都会收到我的电子邮件?我知道反垃圾邮件过滤器正在变得越来越好,但如果我能采取更多措施来减缓垃圾邮件发送者的速度,我会的。
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.
On the other hand, the HTML one seems a bit basic, the bot writers should have figured it out by now...
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.
发布评论
评论(10)
您可以使用reCAPTCHA Mailhide 功能。这将以表单呈现电子邮件地址
[电子邮件受保护]< /code> 其中省略号是查看完整地址的链接。这对访客来说有点麻烦,但应该提供优质的保护。话虽如此,此技术不会让您的访问者直接从您的网页复制地址。
我不明白关于像谷歌这样的“合法爬虫”的部分。至少,我不明白为什么 Google 无论如何都应该索引电子邮件地址。(请参阅下面的 OP 评论。)You could use the reCAPTCHA Mailhide functionality. This will render email addresses on the form
[email protected]
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.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.)我只是使用:
I simply use:
当用户将鼠标悬停在链接上或在移动设备上触摸它时,我的版本会根据 Base64 编码的电子邮件字符串动态生成链接。所有具有“data-gen-email”属性的链接都将起作用。
您可以使用
btoa('mailto:[email protected] 将电子邮件编码为 Base64 ]')
,或网络上的其他地方:html 中的示例链接:
My version generates the link on the fly from a base64-encoded email string when the user hovers over the link, or if on a mobile device, touches it. All links with the attribute 'data-gen-email' will work.
You can encode your email to base64 by using
btoa('mailto:[email protected]')
, or elsewhere on the web:Example link in html:
完整的反垃圾邮件版本
Full AntiSpam version
这就是我用的。我不知道我在哪里找到的。我根本不懂 javascript,所以需要“Javascript for Dummy's”版本。 :-) 希望我知道如何预先填写主题行。有一天……也许吧。
结果:[电子邮件受保护]
This is what I use. I don't know where I found it. I'm not javascript savvy at all so needed the "Javascript for Dummy's" version. :-) Wish I knew how to make it pre-fill in a subject line. Someday...maybe.
Result: [email protected]
JavaScript 仍然是最好的 mailto 混淆器之一。对于禁用 JavaScript 的用户,您可能需要将 mailto 链接替换为联系表单的链接。
以下是流行的 JavaScript 反垃圾邮件混淆器:
还有上述的一个 php 版本能够从服务器端生成混淆的电子邮件。
这是上述工具生成的 JavaScript 代码,用于混淆我的电子邮件地址(注释完好):
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.
The following is a popular JavaScript anti spam email obfuscator:
There is also a php version of the above to be able to generate obfuscated emails from the server side.
This is the JavaScript code that the above tool would generate to obfuscate my email address (comments intact):
这看起来是一种非常酷的字符编码方法,我认为它可以击败基本的垃圾邮件机器人:
http://robspangler.com/blog/encrypt-mailto-links-to-stop-email-spam/
因此
它很有
吸引力,因为它不需要任何 Javascript。
这里是 Plunker 示例。
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/
So
becomes
It's appealing in that it doesn't require any Javascript.
Plunker example here.
基于 Daniel Vassallo 的回答,加密 mailto 链接的一种方法可以避免更聪明的垃圾邮件机器人评估 JS
document.write
(正如 incarnate 所指出的)将解密放入 Javascript 函数中,该函数仅在单击链接时进行评估。例如,使用 base64 作为“加密”:Working Plunker。
我并不声称知道这是否可以被更复杂的爬虫程序所超越。
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":Working Plunker.
I don't claim to know whether this could or could not be outsmarted by a more sophisticated crawler.
您可以使用 aemail.com 等外部服务:
在 aemail.com 输入电子邮件后,您将获得一个简短的 URL,可用于替换您的“mailto”链接。单击链接后,您的用户将被重定向到“mailto”URL,而 aemail.com 不会发出任何通知。 API 可用于动态隐藏电子邮件/获取 URL。
示例:
[电子邮件受保护]">联系人
替换为
联系人
将保持电子邮件链接正常工作。
You can use external services like aemail.com:
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.
Example:
<a href="mailto:[email protected]">Contact</a>
Replaced With
<a href="https://aemail.com/q2">Contact</a>
Will Keep Email Link Working.