Home » Archives » February 2005 » Spammed Out?

[Previous entry: "Do Not Execute"] [Next entry: "BBCode?"]


Monday, February 21st

Spammed Out?  - or

Prevent Spam Email Crawlers from Harvesting Your Site

category: spamming, javascript

I don't know about you, but my delete key is wearing out. If you have your email address displayed on a web page, then here is some javascript that will help you slow the spammers down a little. What it does is create your email link when your page loads, providing no email address for spam crawlers to harvest. I don't know how smart these crawlers have become, so I have used silly variable names, an "%40" instead of the typical "@" sign, and spread the relevant components around a little. This may be a little paranoid, but as I said, my delete key...

This part goes in the head of your document:

<script language="Javascript">
<!--
// these two variables are used in the email address creation, put
// them in the head of your document with your other javascript.
//

last = "yourdomain.com";
badword = "'mailto:";
//-->
</script>


This part goes in place of your email link:

<p class="links">
<script language="Javascript">
<!--
// Put this code in the body of your page in place of you email link,
// and style it however you like. "doodaa" is your email address to
// the left of the @ sign. "Email Myname" is what appears on your page.
doodaa = "myname";
document.write("<a href=" + badword + doodaa + "%40"
+ last + "'>");
document.write("Email Myname");
document.write("</a>");
//-->
</script>
</p>

Good Luck.

Entry Author

He said on 02.21.05 @ 04:25 PM CST


Notes to readers:
This is a printer friendly page.

More on this general topic, or any other, can easily be found by clicking on the links in the Search by Category section of the sidebar. Highly specific, or cross topic searches can be performed by entering key words in the Search by Keyword form in the sidebar.

Readers with Internet Explorer can use these links to "Add to Favorites."

Click here to add this page to your favorites!
Click here to add this site to your favorites!

Remember, these Awesome Tips and Tricks are also provided by the other members of our back office staff. Awesomely Active Web Design, located in Chicago, creates and extends web sites with focus on e-business applications and custom design. Oh, the guys in the front office want us to remind you to check out our services links because we do, after all, do this stuff for a living.

Awesome Services