Welcome to WebmasterWorld Guest from 54.166.152.121

Forum Moderators: open

Message Too Old, No Replies

How to protect email addresses from harvesting

     
4:03 pm on Oct 7, 2012 (gmt 0)

10+ Year Member



Several searches on this topic found mostly entries several years old, so I thought I'd ask again.

To encrypt email addresses in web pages I use:

<script type="text/javascript">
<!--
function escramble(){
var a,b,c,d,e,f,g,h,i
a='<a href=\"mai'
b='abc'
c='\">'
a+='lto:'
b+='@'
e='</a>'
f=
b+='example.com'
g='<img src=\"'
h=''
i='\" alt="Email abc" border="0">'
if (f) d=f
else if (h) d=g+h+i
else d=b
document.write(a+b+c+d+e)
}
escramble()
//--></script>


This is quite cumbersome.

Is there a cleaner way to achieve the same thing?
5:16 pm on Oct 8, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just by relying on JavaScript, you've eluded the vast majority of SPAMmers. Then by obscuring the "mailto:" and exploding the email address into its component parts within your code, you're safe from just about anything short of a JavaScript emulator. So you could compact your code into fewer steps and still be pretty confident in the overall result.

The alternative is to rely on a mail form that never presents the Email address to users in any way. But then you have bots that blindly fill in those forms and you end up with some SPAM regardless of your efforts. So there's no foolproof solution.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month