Happiness and Misadventures

My Solution Against Spam

If you have a website, the problem of sharing your email address in a “safe” way shouldn’t be new. The mailto: links are just too easy to detect from bots and crawlers, which are always more super-efficient. I have no idea about the technology they might use, but it’s always the same game of the cat and mouse to avoid spam. Everybody hates it, and so do I.

For my website, I opted for a double solution. First, a simple JavaScript alert that, when clicking on the email button, just shows the address. The trick is that, in order to write the email in plain text, I put it encoded1 in the script:

<script>
    function decodePopup() {
    alert(atob("V3JpdGUgbWUgYXQ6IG1haWwgQCBleGFtcGxlLmNvbQ=="));
    }
</script>

Then, to call the function on the link:

<a href="javascript:void(0)" title="email 🐌 example.com" onclick="decodePopup()">…</a>

This is the pop-up:

Notice: In order to zoom the images, JavaScript must be enabled.

If you notice, the title tag shows the email almost in plain text, but I’m confident that, for now, it is enough. As double solution, it also shows the email when hovering on the link:

Notice: In order to zoom the images, JavaScript must be enabled.

To be honest, I wanted to show the snail emoji in the JS pop-up, but I’m still working on it.

Is it an elegant solution? I don’t know. Is it handy? I couldn’t say. Did I spend too much time working on it? Oh, yes.

Finally, here is the StackOverflow question that helped me a lot.


🎮 Really enjoying Dredge

🎧 10,000 Days by TOOL – again

📖 Still on Solaris because I fall asleep while reading – it’s not the book’s fault!


  1. I’m aware that base64 is not encryption, but it’s better than plain text — and it’s easy to decode with JavaScript. ↩︎


Reply by email ✉️