Javascript email address obfuscation

Discussion in 'ASP Snips' started by BluJag, Sep 19, 2005.

  1. BluJag

    BluJag Perch

    Free of charge from Jim Tucek at http://www.jracademy.com/~jtucek/email/index.php

    This is a piece of javacript which encrypts email addresses using 10-bit RSA, so even if your site is visited by a spambot which understands JavaScript it won't find any plain text email addresses, just a garbled string that makes no sense at all - the email address only gets decrypted when someone clicks on the link, as intended. What's more, to prevent spambots from recognising source code, Tucek uses a server side script which randomly names all variables and functions.

    An excellent and useful piece of code that should be on everyones website.

    Rating 10/10
  2. jonyah

    jonyah Perch

    I wrote a simple javascript function to "hide" email addresses from spam bots too. I have it up on many sites such as http://www.ajaxscripts.com (sites I haven't put any content on yet). It's a bit more simple and just as effective. You can pull out the styles to make it even more simple.

    Code:
    <script language="JavaScript">
    <!--
    	function displayEmail(account, server, domain)
    	{
    		fulllink = "<a style='color: white;font-family:arial; font-size:10px; text-decoration: none' href='mailto:" + account + "@" + server + "." + domain + "'>" + account + "@" + server + "." + domain + "</a>";
    		document.writeln(fulllink);
    	}
    -->
    </script>
    <script language="JavaScript">displayEmail("administrator","ajaxscripts","com");</script>

  3. Yash

    Yash Bass

    this is something we definately can use at jodohost.com. We receive so much trash everyday

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services