homepage Welcome to WebmasterWorld Guest from 50.19.155.235
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library : Charter : Moderators: whoisgregg

JavaScript and AJAX Forum

    
How to protect email addresses from harvesting
myrrh




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

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?

 

rainborick




msg:4505549
 5:16 pm on Oct 8, 2012 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved