Updated:
July 9, 2007
Webmeister How To Files
Prevent Robots From Harvesting Your Email Address
Robots scan the text of your web pages for information. Usually it’s
for a good purpose, like indexing your pages for a search engine’s database.
However, some robots are used by spammers who want to collect email
addresses to send their junk to over and over again.
Don’t let them find
you! Use the following code instead of a mailto: link on your web
pages. Here’s how to do it in Dreamweaver:
- Drop your cursor on the page
where you want the email link to appear.
- Switch to CODE VIEW if you aren’t
there already.
- Copy and paste the following code, keeping spacing exactly the
same:
<script language="javascript" type="text/javascript">
<!--
var theuser = "bcarpent";
var thehost = "mail.owls.lib.wi.us";
var themessage = "Contact the OWLS Webmeister";
document.write("<a href=" + "mail" + "to:" +
theuser + "@" + thehost + ">" +
themessage + "</a>")
//-->
</script>
- Modify the necessary elements:
bcarpent would be changed to the first part of your email address username.
mail.owls.lib.wi.us would likely remain the same.
Contact the OWLS Webmeister could be changed to whatever text you want people
to click on as the link to send an email.
- That’s it!
NOTE: When you view the page in DESIGN VIEW, you will not see the script or the
link
text. It will look like nothing is there. Just check the code, upload your page,
and test!