JavaScript eMail Encrypter


JavaScript eMail Encrypter

You can encrypt mailto: links on a website, so that spiders can’t detect them, with a simple javascript.

Add these lines to <head></head>:

    <script type="text/javascript"> <!--
    function UnCryptMailto( s )
    {
        var n = 0;
        var r = "";
        for( var i = 0; i < s.length; i++)
        {
            n = s.charCodeAt( i );
            if( n >= 8364 )
            {
                n = 128;
            }
            r += String.fromCharCode( n - 1 );
        }
        return r;
    }

    function linkTo_UnCryptMailto( s )
    {
        location.href=UnCryptMailto( s );
    }
    // --> </script>

Copy and paste below code

<script type=”text/javascript” >
    function CryptMailto()
    {
        var n = 0;
        var r = “”;
        var s = “mailto:”+document.forms[0].emailField.value;
        var e = document.forms[0].emailField.value;

        e = e.replace( /@/, ” [at] “);
        e = e.replace( /\./g, ” [dot] “);

        for( var i=0; i < s.length; i++ )
        {
            n = s.charCodeAt( i );
            if( n >= 8364 )
            {
                n = 128;
            }
            r += String.fromCharCode(n+1);
        }
        document.forms[0].cyptedEmailField.value = r;
        document.forms[0].HTMLCyptedEmailField.value = “<a href=\”javascript:linkTo_UnCryptMailto(‘”+ r +”‘);\”>”+ e +”</a>”;
    }

    function UnCryptMailto( s )
    {
        var n = 0;
        var r = “”;
        for( var i = 0; i < s.length; i++)
        {
            n = s.charCodeAt( i );
            if( n >= 8364 )
            {
                n = 128;
            }
             r += String.fromCharCode( n-1 );
        }
        return r;
    }

    function linkTo_UnCryptMailto( s )
    {
        location.href=UnCryptMailto( s );
    }

</script>

    <form>
        <div>
            <div class=”container”>
                <div class=”desc”>enter your eMail address:</div>
                <div><input value=”” name=”emailField” size=”40″ maxlength=”255″ type=”text”></div>
            </div>
            <div class=”container”>
                <div class=”desc”><input name=”ecrypt” value=”Crypt eMail Address” onClick=”CryptMailto()” type=”button”></div>
                <div>  </div>
                <div> <br><br>
                <div class=”container”>
                    <div class=”desc”>crypted eMail:</div>
                    <div><input value=”” name=”cyptedEmailField” size=”40″ maxlength=”255″ type=”text”></div>
                </div>
                <div class=”container”>
                    <div class=”desc”>html code:</div>
                    <div><textarea name=”HTMLCyptedEmailField” cols=”50″ rows=”8″></textarea></div>
                </div>
            </div>
            <h3>Add these lines to <head></head>:</h3>
        </div>
    </div>
</form>

If you have any query then feel free to contact me at Jainish Senjaliya

Advertisements

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