web blazonry web development scripts and tutorials Get best price on Unlocked Galaxy S20 5G
   PHP       Name Generators       Perl       CSS       Javascript       Java       MySql       How Tos       Resources   

Javascript Home


image scripts
  Image Load Order
  Mouse Overs
  SlideShow

JavaScript Resources
  Free JavaScript Books(new)
  Recommended Sites
  Bestselling Books

Bookmark and Share




JavaScript : Hiding Email Addresses

Also known as “Fooling SpamBots”, this JavaScript code example makes it difficult for SpamBots to automatically obtain email addresses when they scan your web pages. The JavaScript function “breaks” your email address into components and “re-assembles” the components for display on the page.

As a result, there is nowhere in your source code that provides a full, intact email address that can be easily parsed from your file. Anything one can do to fool spammers is a good thing I say.

Here's the code for the function:

<SCRIPT LANGUAGE="JavaScript">
<!--

var lhs = "web";
var rhs = "blazonry.com";

function print_mail_to_link()
{
   document.write("<a href=\"mailto");
   document.write(":" + lhs + "@");
   document.write(rhs + "\">" + lhs + "@" + rhs + "<\/a>");
}

//-->
</SCRIPT>

Here's the code to call the function:

This code goes where you want your “mailto” address to appear on the page.

<script language="JavaScript" type="text/javascript">
   print_mail_to_link()
</SCRIPT>

A normal-looking email address link appears on your page and looks like:


But nowhere in your HTML is there an email address that is intact and deciperable by SpamBots. (grin)

Of course, you can modify the function to display the email address not as a link but as plain old non-linkable text.

 

Newest Pages
Test Google Ads Ver. 2
Free Linux Admin Books
Free Linux Books for Programmers
Free Books for Linux on the Desktop
Free PHP Books
Free JavaScript Books
Free Java Books - Advanced
Free Java Books - Basic
Free Perl Books
Free Python Books
Quote of the Day (PHP)
Debugging Part 2
How to Test Google Ads
Most Popular Pages
Baby Name Generator
U.S. Name Generator
Wu Name Generator
Popup Windows (JavaScript)
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL
Intro to Web Databases (PHP, MySQL)

Least Popular Pages
iNews Applet (Java)
Java Resources
Site Monitor (Perl)
PHP Resources
 
 

  privacy policy     ||     © 1997-2016. astonishinc.com   All Rights Reserved.