Print Page | Close Window

Cloaking email addresses - very cool

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Web Design Discussion
Forum Description: Discussion on web design and development subjects.
URL: https://forums.webwiz.net/forum_posts.asp?TID=4020
Printed Date: 29 March 2026 at 9:19am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Cloaking email addresses - very cool
Posted By: Bluefrog
Subject: Cloaking email addresses - very cool
Date Posted: 02 July 2003 at 8:38pm

I stumbled across a site that has a very cool way to cloak email addresses against spiders and bots. Check it out at:

http://omt.net/contact.html - http://omt.net/contact.html

This is the script:


<!-- Email-->
<SCRIPT LANGUAGE='JAVASCRIPT'>


function sendto(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;
}

function showText(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++;
}
document.write('&');
document.write('#');
document.write(decrypt(number,n,d));
}
}

function decrypt(c,n,d) {
// Split exponents up
if (d % 2== 0) {
bar = 1;
for(var i = 1; i <= d/2; i++) {
foo = (c*c) % n;
bar = (foo*bar) % n;
}
} else {
bar = c;
for(var i = 1; i <= d/2; i++) {
foo = (c*c) % n;
bar = (foo*bar) % n;
}
}
return bar;
}
// Stop hiding the script -->
</SCRIPT>




Replies:
Posted By: Ghostnet
Date Posted: 03 July 2003 at 10:35pm

Pretty good.  I've been getting a lot of spam lately.  Looks like a good system.  Thanks for the post.



-------------
evolution is a vehicle. drive responsibly


Posted By: copenhagen
Date Posted: 07 July 2003 at 10:17am
where in that script do you put an email address????


Posted By: Gullanian
Date Posted: 07 July 2003 at 10:41am
does webwiz do any email cloaking?


Posted By: xeerex
Date Posted: 07 July 2003 at 6:29pm

The only problem with that one is that it won't display the actual address for those using a web-based email client. They can't see the actual address. Here's a much simpler one:

<SCRIPT type="text/javascript" language="javascript">
<!-- Begin
a="me";
b="mydomain.com";
document.write('<a href=\"mailto:'+a+'@'+b+'\">');
document.write(a+'@'+b+'<\/a>');
// End -->
</SCRIPT>

I put that in an asp page and just use an include wherever I want it, which I find much simpler that putting the code in everytime. The only problem with either of these would be a site browser that has javascript disabled on their browser. Those are few and far between though.

Too bad there is not a way to do it in ASP though...



-------------
http://webspacegeeks.com - Need Hosting, Domains, Dedicated Servers?
http://www.smartergeek.com - web design | pc support | training | podcasts | video production


Posted By: Bliss
Date Posted: 07 July 2003 at 7:22pm
Yeah, server sided protection would be awesome!


Posted By: Bluefrog
Date Posted: 08 July 2003 at 12:05am

For server side protection you just need to use a form and do the email from the server. Another way is just to put the email address in a graphic. .NET let's you do that on the fly. Some ASP components do as well.

As for entering an email address in the script, you don't. You just call the function and pass a string. It decrypts it and pops up a MAILTO:. So you need to reverseengineer the encryption (cipher, whatever) for it. Shouldn't be to hard. I haven't tried yet because it just looked cool. I'm far to lazy at the moment... (Still busy with Flash and .NET).



Posted By: xeerex
Date Posted: 08 July 2003 at 9:59am

Yeah--but forms are not always aesthetically pleasing or functional and neither is a graphic when someone wants to copy/paste the address.

Any other ideas? Of course, I may be looking for the impossible...



-------------
http://webspacegeeks.com - Need Hosting, Domains, Dedicated Servers?
http://www.smartergeek.com - web design | pc support | training | podcasts | video production


Posted By: Bluefrog
Date Posted: 09 July 2003 at 9:28am
I suppose you could try some really nasty client side scripting combined with a few trick serverside to determine if the request if from a bot, and then return the email address if it isn't. But then you've got a monstrous load of work to do... not worth it in my guestimation.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net