Wouldn’t it be nice to post your email address right on your page without having to worry about spam harvesters and other malicious bots?
I do! See an example in the footer section of my Web Development Forums.
I use Javascript to do this. It is a highly effective method for a few reasons:
- Javascript output is unsearchable by search engines.
- Spam harvesters, and most other bots and spiders ignore javascript to avoid being caught in loops and infinite content generators
Here’s how to do it!
Copy and paste the script below into the HTML content of your webpage right where you want the email link to be.
Next, update the actual email information (change the variable values).
admin = you, hypertextfever = yourdomain, com = your tld (com, net, org, etc.))
Next, I recommend changing the variable names. They are currently female names that start with “s”. This is simply preference. It’s just best to diversify these variable names so that bots don’t get “wise” to it.
A good example would be to change the three instances of “susan” to “charlie”, and “sally” to “chuck”, etc. Please be aware that there are three instances of each.
<script type="text/javascript">
var susan = "admin";
var sally = "@";
var sandra = "hypertextfever";
var sarah = ".";
var sonia = "com";
document.write('<a href="mailto:'+susan+sally+sandra+sarah+sonia+'">'+susan+sally+sandra+sarah+sonia+'</a>');
</script>
Easier than an email form, and it’s more usable too!