需要一些关于反电子邮件垃圾邮件 javascript 的帮助

发布于 2024-08-23 02:22:13 字数 733 浏览 4 评论 0 原文

我想使用 JavaScript 保护我的网站免受垃圾邮件机器人的侵害。

我找到了这段代码,我有两个问题。

1 - 此代码会保护我的电子邮件地址吗? 2 - 有人可以解释一下如何添加这一行:

<SCRIPT TYPE="text/javascript">
emailE=('info@' + 'friesecomputerservice.nl')
document.write('<A href="mailto:' + emailE + '">' + emailE + '</a>')
 //-->
</script> 

这是要添加的行:

<span title="Stuur ons een e-mail"

这是我所拥有的,我目前无法测试它,你能验证它是否正确吗?

<script type="text/javascript">
emailE=('info@' + 'friesecomputerservice.nl')
document.write('<a href="mailto:' + emailE + '">' + '<span title="Stuur ons een e-mail">'+ emailE +'</span>' + '</a>')
 //-->
</script>

I want to protect my website against spambots with javascript.

I found this code, I have two questions.

1 - Will this code protect my email adres?
2 - Can someone explain me how to add this line:

<SCRIPT TYPE="text/javascript">
emailE=('info@' + 'friesecomputerservice.nl')
document.write('<A href="mailto:' + emailE + '">' + emailE + '</a>')
 //-->
</script> 

This is the line to add:

<span title="Stuur ons een e-mail"

This is what I have, I can't test it at the moment, can you verify it's correct?

<script type="text/javascript">
emailE=('info@' + 'friesecomputerservice.nl')
document.write('<a href="mailto:' + emailE + '">' + '<span title="Stuur ons een e-mail">'+ emailE +'</span>' + '</a>')
 //-->
</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

樱花落人离去 2024-08-30 02:22:13

我们一起来分析一下代码
emailE=('info@' + 'friesecomputerservice.nl')
var emailE 等于 2 个字符串的串联
其计算结果为 `emailE = '[email protected]',

然后是第二个线
document.write('' + ''+ emailE +'' + '')
写入的是文档的 HTML 行
[电子邮件受保护]">[email  ;受保护]
它由网络浏览器翻译成普通的电子邮件链接

该脚本的作用..它不会按原样将电子邮件写入文档中
它使机器人阅读电子邮件变得更加困难

尽管它还不够好,但
普通机器人在 HTML 标记后仍然可以清楚地阅读您的邮件

我建议您将电子邮件写在图片中,并将其显示在页面中

如果您想动态创建图像(例如加密用户特定的电子邮件),您可以搜索对于 PHP 库,这将在服务器端创建图像

Let's analyse the code together
emailE=('info@' + 'friesecomputerservice.nl')
a var emailE equals a concatenation of 2 strings
which is evaluated to `emailE = '[email protected]'

then second line
document.write('<a href="mailto:' + emailE + '">' + '<span title="Stuur ons een e-mail">'+ emailE +'</span>' + '</a>')
Writes is the document an HTML line
which is <a href="mailto:[email protected]"><span title="Stuur ons een e-mail">[email protected]</span></a>
Which is translated by web-browser into an ordinary link to email

What this script does .. it doesn't write the email in document as it is
it makes it bit harder for bots to read the email

although it isn't good enough
an ordinary bot can still read your mail clear after HTML markup

I advice you to write your email in a picture, and show it in the page

If you want to create the image dynamically (to encrypt user specific email for example), you can search for a PHP library , that would create the image at the server side

清旖 2024-08-30 02:22:13

一般来说,一个“像样的”机器人能够分析页面渲染的 HTML(如:您在屏幕上看到的内容),所以 IMO 这不起作用 - 机器人将能够看到完整的电子邮件地址。

我会使用验证码填写联系表格。我个人不喜欢电子邮件地址的图像,因为它(根据我的经验)会惹恼最终用户。

Generally a "decent" bot would be able to analyse the rendered HTML of the page (as in: what you would see on screen), so IMO this wouldn't work - the bot would be able to see the full email address.

I'd go down the route of a contact form with CAPTCHA. I personally don't like an image for the email address, as it (in my experience) annoys end users.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文