Email Address Cloaking
There are various spiders or address-harvesting robots designed to extract email addresses from web pages for spam fuel. They scan web pages and harvest any strings that have the format username@domain.ext.
In order to hide your email address from these bots you can replace your email address in the html page with some simple Javascript code:
<script language="JavaScript">
<!--
emailname = "username"
emailserver = "domain.ext"
document.write("<a href='mailto:" + emailname + "@" + emailserver +"'>");
document.write(emailname + "@" + emailserver);
document.write("</a>");
-->
</script>
Place this snippet of code directly into the HTML copy, at the point where you want the email link. For example, if your email address is freewoolyworms@yahoo.com, your script would look like
<script language="JavaScript">
<!--
emailname = "freewoolyworms"
emailserver = "yahoo.com"
document.write("<a href='mailto:" + emailname + "@" + emailserver +"'>");
document.write(emailname + "@" + emailserver);
document.write("</a>");
-->
</script>
The line of code (document.write(emailname + "@" + emailserver);) determines what the link should say. If you want it to display "Send me email -- woof!" then it would read document.write("Send me email -- woof!"); You simply place the desired text in quotes between the parentheses. The way the line is scripted above, the link merely displays the email address itself. No matter what you set for the display, the email address will never show itself to spam harvesters.
You can also create a Javascript function to use in pages where your email address appears multiple times. The page has to be saved as an ASP page.
Paste the following code in the heading section (after <head> and before </head>).
<script language="JavaScript" RUNAT=SERVER>
<!--
function ecloak3 ( emailname, emailserver, text)
{
if (text == "") text = emailname + "@" + emailserver
return "<a href='mailto:" + emailname + "@" + emailserver +"'>" + text + "</a>";
}
-->
</script>
You can call the function in various ways:
==========================
example 1:
<p>My address is
<%
Response.write (ecloak3("freewoolyworms","yahoo.com", ""))
%>.</p>
Looks like
My address is freewoolyworms@yahoo.com.
==========================
example 2:
<p>My name is
<%
Response.write (ecloak3("freewoolyworms","yahoo.com", "Noodle-head"))
%> and you can contact me!</p>
Looks like
My name is Noodle-head and you can contact me!
==========================
Be sure to save the page with an ASP extension.
Concept attributed to John Springer