[X]

Hide Your Email From Spambots

browser tricks 1998 still works

Builds a mailto link in JavaScript so a plain-text harvester never sees it.

In 2026: Works, and still helps against the simplest scrapers. Anything that runs JavaScript reads it fine, so treat it as speed bump, not armour.

Where it came from: Anti-spam advice from Usenet and the web FAQs of the late 90s. Wikipedia

<script language="JavaScript">
var user = "webmaster";
var host = "example.com";
document.write('<a href="mail' + 'to:' + user + '@' + host + '">'
             + user + ' at ' + host + '</a>');
</script>

<noscript>webmaster at example dot com</noscript>

<!-- The character-code version, for maximum 1998 authenticity -->
<script language="JavaScript">
var e = "";
var c = [119,101,98,64,101,120,97,109,112,108,101,46,99,111,109];
for (var i = 0; i < c.length; i++) e += String.fromCharCode(c[i]);
document.write('<a href="mailto:' + e + '">Email me</a>');
</script>
sandboxed demo · breaks nothing but itselfrestart

More in browser tricks

all 25 in browser tricks › · the whole library ›