January 14, 2003

Fighting Spammers

Noticed that some bloggers are using Javascript to hide the mailto: tags from spammers, but still enable users to click on a link which a browser thinks is a mailto: anyway. For example, here's the code from the homepage of Adam Medros's blog (which, by the way, I've begun regularly reading -- he's a grad student blogging his experience at Harvard Business School).

Instead of the a href mailto code in the HTML, there's a javascript:goForth() function call. The function looks like this:

	function goForth(c,n,d) {
	c += ' ';
	var length = c.length;
	var number = 0;
	var bar = 0;
	var answer = '';
	for(var i = 0; i < length; i++) {
	number = 0;
	bar = 0;
	while(c.charCodeAt(i) != 32) {
	number = number * 10;
	number = number + c.charCodeAt(i)-48;
	i++;
	}
	answer += String.fromCharCode(decrypt(number,n,d));
	}
	// Updated security feature
	parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+answer;
	}

And the mailto invocation inside the A HREF looks like this:
	javascript:goForth("79 492 121 428 518 506 455 100 156 287 518 518 71 437 518 79",629,461)

Very interesting.

UPDATE 30 Jan 2003 --- Finally found the author and more details on this Javascript code. It's called Email Protector and the link has everything you need. Posted by brian at January 14, 2003 03:25 AM

Comments

brianstorms is Brian Dear's weblog. Non-spam email:

Be sure to take a look at these other fine websites:

Copyright 2002-2003 Birdrock Ventures. brianstorms is a trademark of Birdrock Ventures.