homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

How to protect email addresses from harvesting

5+ Year Member

Msg#: 4505099 posted 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'
g='<img src=\"'
i='\" alt="Email abc" border="0">'
if (f) d=f
else if (h) d=g+h+i
else d=b

This is quite cumbersome.

Is there a cleaner way to achieve the same thing?



WebmasterWorld Senior Member 10+ Year Member

Msg#: 4505099 posted 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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved