Below I explain an email obfuscation solution I devised that:
- is accessible for people using screen readers;
Here is what an email address looks like in the text-only web browser, Lynx:
Basically, all instances of text that match the pattern of email AT domain DOT tld are replaced with the hyperlinked, usable versions, using the magic of regular expressions.
Although email addresses of the form email AT domain DOT tld can be retrieved with a simple Google Search, simple wildcard matching picks up natural phrases as well, and proper regex matching is computationally expensive. My method, in my opinion, provides a nice balance between human accessibility and email-harvester obstruction.
User Error Handling
If you are integrating email obfuscation into a CMS, you can add also user error handling to prevent users from posting naked email addresses. For example, if the user posts “firstname.lastname@example.org” in plain text, they would get this client-side error message:
Here is the example source code of the improved MagicEmailAddress script:
Here is a working demo of the consequences of just posting “email@example.com” (the example source code above), and here is another demo where the text “E-mail” links to “mailto:firstname.lastname@example.org”. Both demos have the same error message, but they are handled by the same improved MagicEmailAddresses script.
In practice, this would be useful on dynamic websites. A real working demo is within the WordPress theme I developed for The Centre for Women and Trans People at U of T. If the blogger posts an email address in plain text, they will encounter the error message and will have to reconfigure the email address to make the error message go away. Previously, I found that my reminders not to post naked email addresses were not always followed, so I hope that by automating the corrective feedback, it will save me future work from manually reminding or manually correcting the posts.
Update: Judging from the statistics on the effectiveness of email obfuscation methods, my method should prevent over 99 percent of spam. My email obfuscation method is also much more simple and direct than A List Apart’s method.