How to use JS spam protection on email to hide the form from spam bots.
-
If you're talking about using action="mailto:emailaddress" on a form, and wanting to hide the email address from website scrapers, then I would say you shouldn't do that in the first place. Have your form processed by a server-side script which emails the form data to you. This not only keeps your email address away from prying eyes, it also gives you the benefit of being able to format the user's data to be more readable, and allows users without a mail program (for example, webmail users) to submit your form. – Rudism Dec 04 '09 at 00:00
-
Lots of people have asked similar questions (and you could consider this question to be a duplicate): http://stackoverflow.com/questions/483212/effective-method-to-hide-email-from-spam-bots http://stackoverflow.com/questions/163628/making-email-addresses-safe-from-bots-on-a-webpage http://stackoverflow.com/questions/1292326/do-you-hide-email-addresses-to-spam-bots-on-websites – Zach Johnson Jan 16 '10 at 23:21
-
It really isn't worth it. A number of address harvesters already run JS, and an email address is bound to leak at some point anyway. Just get good spam filtering on your mail server and avoid putting any barriers between users and their ability to email you. – Quentin Mar 15 '10 at 13:06
3 Answers
You don't. Putting JavaScript into email is a very bad idea for potential security and privacy violations. Instead include a link in your emails to the form on a web page. Email is inherently private and the web is inherently public. If exposing the form to a user is not a private event then it should not go in an email.
I'm not sure this is affective any longer, if it ever was, but I was under the impression that encoding your email address in hex was one effective way to limit spam harvesting.
e.g.; mailto:
is the leading "mailto:"
I've been using it on my site, but I also use Google apps for domain email, so it catches all the foo that does come through.

- 51
- 7
I'm not sure that I'm answering your question correctly, there isn't much detail.
I think what you're asking is how you can hide email addresses, in html, from spam bots - in which case here is the answer (there is no point in me paraphrasing it):

- 5,769
- 6
- 30
- 40