Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Senior Member visualAd's Avatar
    Join Date
    Jan 2003
    Location
    Slough, UK
    Posts
    201
    Member #
    434
    So you have a web site and you want your visitors to be able to contact you. For one reason or another you do not want to use a web based contact system and through fear of being bombarded left, right and center with spam, you do not want to put a mailto link on your contact page. So your visitors are left with no way of contacting you.

    The majority of spam bots crawl the net in search of e-mail addresses in plain text such as:
    me@mydomain.com

    One way of making it more difficult for a spam bot to find your email address is to conceal it within your page. This is where JavaScript comes in useful; being a client side scripting language your scripts are sent to the client and left to their web browser to execute. It is possible to write a script that gets the browser to generate a mailto link with your e-mail address in without sending it in plain text. There are many ways of doings this, such as using encryption and bit shifting, but by far the easiest way is to use the String.fromCharCode() function. This function takes any number of ASCII character codes as arguments and generates the corresponding character. With the help of an ASCII character code table, this simple function will do the trick:
    Code:
    <script language=”JavaScript1.2”>
    <!--
    function makelink ()
    {
    	var str;
    		
    	str = "<a href=\"";
    	str = str + String.fromCharCode(109, 97, 105, 108, 116, 111, 58);
    
    	// first part
    	str = str + String.fromCharCode(109, 101);
    
    	// the at sign
    	str = str + String.fromCharCode(64);
    
    	// the domain part
    	str = str + String.fromCharCode(109, 121, 100, 111, 109, 97, 105, 110, 46, 99, 111, 109);
    
    	str = str + "\">Contact Me</a>";
    	
    	return str;			
    }
    -->
    </script>
    This function will generate a string: “<a href=”mailto:me@mydomain.com”>Contact Me</a>”
    You can then include this string anywhere in your page using the following scriptlet:
    Code:
    <script language="JavaScript1.2">
    	<!--
    		document.write (makelink ());
    	-->
    </script>
    I’m not saying using this method will make it impossible for spammers to get your e-mail address, but it does add a layer of protection and these days the majority of good web browsers support JavaScript.

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:25 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com