Hide Email Address from Bots - Keep mailto:
Obfuscate your email using JavaScript. Instead of a direct mailto:
link, JavaScript constructs your email address on page load, thus outsmarting simple bots. This is the formula:
In your HTML:
The actual email isn't in the HTML-rendered code. Bots won't see it, but humans will get a clickable mailto:
link on your site.
Advanced bot evasion methods
CSS pseudo-elements
Use CSS pseudo-elements to provide extra layers of deception against bots. Simple, yet effective:
In HTML:
JavaScript for mailto:
Bypassing bots with PHP
A server-side script can safely handle email on the server side. Here's a PHP example:
Accessibility meets safe emails
For accessibility, solutions that don’t rely solely on Javascript are essential. Use ARIA labels and ensure that email addresses are interpretative for screen-readers:
Defeating spam at the source
Email filters and SpamAssassin on the server help nab spam before it invades your inbox. Combine this with a chat-like email client to further mitigate exposure:
Armor your email address
The "picture" perfect solution
Consider using an email depicted as an image. Although less accessible to screen readers, this can serve as a quick fix:
Create an email labyrinth
Play hide and seek with bots using a dynamic replacement strategy for mailto:
links:
Iframes and redirects: Oldies but goodies
Users where JavaScript is off can still have clickable email links without exposing the address directly:
Server handles mailto functionality and redirects, concealing the address throughout.
Was this article helpful?