Hide Email
It is standard to provide contact information on any website. In fact, not providing contact information on a website can hurt one’s credibility and cause one to lose business. An email address is a standard part of contact information. Many may fear posting their email address for fear spiders, robots, harvesters, spammers, etc. may collect their email address for a variety of unethical reasons. Do not hurt your credibility by fearing them. These types of collectors read the code behind websites. There are a variety of ways to scramble an email address causing the robot to pass over the email address unable to harvest.
JavaScript is one easy way to hide your email address from spammers and email harvesters.
- Open your html document in your favorite text editor.
- Link an external JavaScript file to your html file:
- Place the following code before the closing head of your file such as:
<script type=”text/javascript” src=”spam.js”></script>
</head>
- Go to the area in the html file you wish to put your email.
Place a script similar to the following in that location with adjustments to the greenĀ and brown text:
<script type= “text/javascript”>
showEmail(”ngised“,”moc.remooctcartnoc“);
</script>
The brown area is the part of your email address before the @ spelled backwards.
The green area is the part of your email address after the @.
This example shows my email address design and contractcoomer.com.
- Next create a blank JavaScript file by open your favorite text editor creating the following code:
// JavaScript Preventing Email Harvesting
function showEmail(emailName,emailServer) {
userName = stringReverse(emailName);
emServer = stringReverse(emailServer);
var emLink = emailName+”@”+emailServer;
document.write(”<a href=’mailto:”+emailLink+”‘>”);
document.write(emailLink);
document.write(”</a>”);
}
function stringReverse(textString) {
if (!textString) return ”;
var revString=”;
for (i = textString.length-1; i>=0; i–)
revString+=textString.charAt(i);
return revString;
}
- Save the code as spam.js
This JavaScript code unscrambles the email text to the visual eye, while remaining scrambled to the metal eye.
Do you see what I am saying?

