How should I solve the e-mail privacy issue on the webpage, so it is not displayed in plain text in HTML code?

Malicious bots scrape the web in search of email addresses and plain text email addresses are more likely to be spammed.

有帮助吗?

解决方案

A number of ways that you can do this:

  • spell the email out 'info at domain dot com'

  • create an image of the email address

  • use a contact form with additional anti-spam measures such as captcha

    Unfortunately. most of these methods make it difficult for end users (especially the first two)

其他提示

I would say the best way is to require the user to solve a CAPTCHA of some kind, and then when they succeed you should give them the email in plain text.

In particular, this allows users to copy-paste it into their email client, without the risk of mis-typing. Additionally, with the right CAPTCHA, this allows users with disabilities to contact you as well.

That said, you can keep your address completely hidden by having a contact form. In this way, it will be your server sending you the email on behalf of the user, and they will only ever know your address if you reply to them.

Quite a common method is to create an image with the email text within it.

Algorithms to read text from an image are a lot more complex (and error prone) than simple web scraping ones!

Edited to expand to include the details given in the comments. It's important that this work be done server side, any manipulation done in javascript is likely to include the email address somewhere in the page's source - which any web scraper will have access to. Better to include an image with no reference to the image at all in it's url.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top