javascript spam prevention

Here’s a basic javascript-only spam prevention technique. The only thing fancy is breaking up the words so, for example ‘mailto’ isn’t a keyword. One thing it lacks is updating the status bar on mouseover.

<html>
<head>
<style>
    .m2 { color: blue; text-decoration: underline }
</style>
<script>
    function m2(element, user, host, subject, body)
    {
        var addr = user + "@" + host;
        var mail2 = "ma" + "ilt" + "o";
        var subj = "su" + "bje" + "ct=" + subject;
        var body = "bo" + "dy=" + body;

        loc = mail2 + ":" + addr + "?" + subj + "&" + body;
        alert("loc: " + loc);

        window.location = loc;
        window.reload();
    }

    function build_addr(elemid, user, host)
    {
        var elem = document.getElementById(elemid);
        var addr = user + "@" + host;

        elem.innerHTML=addr;
    }

</script>
</head>
<body>
    <span id="ema" class="m2" onclick="m2(this, 'aarone', 'one-shore.com', 'MYSUB', 'YOURBOD')";>
    <script> build_addr("ema", "aarone", "one-shore.com");</script>
    </span>
</body>
</html>

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s