Jason Mauss' Blog Cabin

Because someone's got to do the dirty work

Blog-Flair

Blogroll

Links

Cool JavaScript trick

For those of you that worry about spam and your e-mail address being publicly visible on the internet, this one is dedicated to you.

Additionally, if you ever want to provide a really good service to people that input their e-mail address for display on a forum or comments on a site you build, use this:

<!-- Script to thwart spambot/e-mail address harvesters -->
<script language=javascript>
<!--
var linktext = “Bob“;
var username = “Admin“;
var domain = “website.com“;
document.write(“<a href=“ + “mail“ + “to:“ + username + “@“ + domain + “>“ + linktext + “</a>“);
//-->
</script>

I realize this trick has probably been in use by some clever JavaScript developers for years already but, hey, it's news to me.

Comments

Jon Galloway said:

I've been using the Enkoder for a while: http://automaticlabs.com/products/enkoderform/

It's the same kind of idea as you're describing, but it takes the extra step of encoding the e-mail address.
# August 6, 2004 1:52 AM

TrackBack said:

# August 6, 2004 5:13 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)