#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    22
    Rep Power
    0

    Best Method for Obscuring Email Address from Spam Bot Scrapers?


    What's the best method out of these three to hide an email address yet still have it function but still display the correct email address to the user and have it function as a mailto: link when clicked on? (Using Wordpress site in this case)

    2A. USING THE ‘ONCLICK’ EVENT

    You can create a regular mailto hyperlink for your email address but replace some of the characters – like the dot and the @ sign – with text. Then add an onclick event to this hyperlink that will substitute the text with the actual symbols.

    <a href = "mailto:johnATgmailDOTcom"
    onclick = "this.href=this.href
    .replace(/AT/,'@')
    .replace(/DOT/,'.')"

    Contact Me
    2B. RANDOM ARRAY

    Split your email address into multiple parts and create an array in JavaScript out of these parts. Next join these parts in the correct order and use the .innerHTML property to add the email address to the web page.


    WORDPRESS + PHP
    If you are on WordPress, you can also consider using the built-in antispambot() function to encode your email address. The function will encode the characters in your address to their HTML character entity (the letter a becomes a and the @ symbol becomes @) though they will render correctly in the browser.

    <?php echo antispambot("john@abc.com"); ?>
  2. #2
  3. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,304
    Rep Power
    2046
    I almost hate to say it, but that won't work for long, if at all. Where ever you cut-and-paste'd that from is pretty much out of date.

    Email harvester bots are smarter than you think, and they know all of the tricks that you do. It's trivial for one to do a replace in exactly the same way that you did.

    The only way to stop an email address from being harvested is to not publish it. But even then a lot of places guess 1,000's or 1,000,000's of emails for every domain and just send them out to see what doesn't bounce back. Anything that doesn't bounce back is flagged as positive and added to their lists. There's a whole lot more to email harvesting thatn you seen to know.

IMN logo majestic logo threadwatch logo seochat tools logo