widgetsu
w i d g e t s u
Search this site:
      ClokeEmail JavaScript
HTML Thing

xHTML Thing

CSS Generator

Popup Widget
Prevent email harvesters from scavenging email addresses off of your site with this CloakEmail JavaScript. We thought ahead and added a feature that lets an email address be put in backwards. This should fool even the most sophisticated harvesters, now, and in the future.

I have been using this code on websites for years now and have yet to have one of those protected email addresses taken advantage of.

Place this ClokeEmail function once on a page:

<script type="text/javascript">

function ClokeEmail(name, domain)
{
	for (var eman='', i=name.length-1; i>-1; i=i-1)
	{
		eman += name.charAt(i);
	}
	for (var niamod='', i=domain.length-1; i>-1; i=i-1)
	{
		niamod += domain.charAt(i);
	}
	var AddresS = eman + "@" + niamod;
	return AddresS;
}

</script>

Use something like the following line of code in HTML wherever an email address needs to appear. Use it in a "mailto" tag as shown, or by itself as text. Be sure to spell out both the first part (name) and second part (domain) of the email address backwards. There is no need to use the "@" as the script puts it in automatically.

<script type="text/javascript">
document.write('<a href="mailto:'
+ ClokeEmail("ziweht", "moc.ustegdiw") + '">'
+ ClokeEmail("ziweht", "moc.ustegdiw") + '</a>');
</script>

No guaranties are made that this code will work the way you want it to for all browsers. Always test out the code before deploying it to the Web for the whole world to see.

-
  Copyright ©2002 - 2011 By widgetsu. All Rights Reserved.