[thelist] JS hiding email address

Liorean liorean at user.bip.net
Fri Mar 7 19:02:00 CST 2003


Sarah wrote:
>  > If this is only a temporary thing will turning the @ into ascii
>  > not suffice?
>  >
>  > eg; test at domain.com = test@domain.com
>
> I've also been looking for options for "hiding" email addresses on my site,
> and this sounds like a promising idea (and it doesn't use JavaScript, which
> is good). Does anyone know if it would be successful at hiding the email
> address from bots?

There are url-decoding bots. I've never seen one with xml/html entities
decoding.

But, for security, why not combine them?

~~~~@~~~~
var mail='mailto:liorean at user.bip.net';
mail=(function(){
   var s='',i=0;
   for(;i<mail.length;)
   s+='&#0037;'+mail.charCodeAt(i++).toString(16);
   return s
})();

// Results:
#0037;6d&#0037;61&#0037;69&#0037;6c&#0037;74&#0037;6f&#0037;3a&#0037;6c&#0037;69&#0037;6f&#0037;72&#0037;65&#0037;61&#0037;6e&#0037;40&#0037;75&#0037;73&#0037;65&#0037;72&#0037;2e&#0037;62&#0037;69&#0037;70&#0037;2e&#0037;6e&#0037;65&#0037;74
// Hmm, on a second thought, they might get a bit long.
~~~~@~~~~

That way, they have to have a parser able to not only parse the entity
that corresponds to '@', but '%', and then afterward apply url decoding
(the order a browser should be doing it).

Or you could use some coding scheme like:
[plain,urlenc,plain,htmlent][...repeat...]

--
liorean <mailto:liorean at user.bip.net>

ViewStyles, ViewScripts, ToggleStyles and GraphicsInfo bookmarklets and
Theme Switcher, Cookies Handler scripts:
<http://liorean.web-graphics.com/>




More information about the thelist mailing list