« stylecatcher hints for UMN users | Main | Commercial Object Relational Mappings project »

How to obfuscate your UMN e-mail address on your weblog.

If you want people to be able to contact you at the University of Minnesota (or anywhere else, for that matter), but don't want to broadcast your e-mail address to all of the spam robots in the entire world, you might find this little script I wrote this morning very useful.

All you have to do is enter your x500 ID (Also called your Internet ID) in the appropriate spot (mine's listed in the example below as "saintx"), and drop this code snippet into your site template, then you'll be able to display your e-mail address on the website without giving it up to the robots. This is written in JavaScript, which means that your e-mail address won't be reassembled until the webpage loads in the user's browser. Most web crawlers aren't equipped to preprocess JavaScript programs, but only crawl over the HTML for the site.

In any case, here's the code. I've made it available under a very good Open Source License, which is similar to the ASF 2.0 license, so commercial users can write derivatives of it and use it in their software products. I hope it's useful!

--

<!-- e-mail obfuscator, written by
Alexander Saint Croix.  You may
use this script under the terms
of the Academic Free License,
version 2.1.

For more information, please
visit the Open Source Initiative
Website for this license at:
www.opensource.org/licenses/afl-2.1.php
-->

<script language="javascript">
  var x500 = "saintx";
  var dom = "umn";
  var tldom = "ed";
  var tldom2 = "u";
  var campusAddr = x500
      + "@"
      + dom
      + "."
      + tldom
      + tldom2;

  var prot1 = "mail";
  var prot2 = "to:";
  var protocol = prot1 + prot2;

  document.write('<a href="'
      + protocol
      + campusAddr
      + '">'
      + campusAddr
      + '</a>');
</script>

Comments

Thanks a bunch! I just put it on my site.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.