Jump to content

Hiding email addresses from spam bots


bukwus
 Share

Recommended Posts

Hope this isn't redundant.How can I go about hiding email addresses in my HTML pages so that bots can't find them and send spam?Right now they are coded in the basic way:<a href="mailto:email@host.com" ect.In stead of using the email address as the linked text I've just used a name.Many thanks

Link to comment
Share on other sites

With javascript you can disect and rebuild the address in a way that the spam robot doesnt recognise the pattern.<script type="text/javascript"><!--emailE=('him.' + 'her' + '@' + 'somwhere' + '.com');document.write('<a href="mailto:' + emailE + '">Contact Us</a>');//--></script>

Link to comment
Share on other sites

Thanks Scott.Do you know if PHP would work the same way or should I ask that on the PHP forum?Ex:<?php $emailInfo ="info@" . "host." . "com"; print "<p><a href=\"mailto:" . $emailInfo . "\">General Inquiries</a></p>"; ?>

Link to comment
Share on other sites

I don't PHP would work the same. PHP is server side so the fully constructed email address would be sent when the page is rendered. Using JavaScript which is client side means that when the page renders the email address is not there but takes a split second for the javascript to build it, thus fooling the bot.

Link to comment
Share on other sites

Thanks aspnetguy.I added the javascript and tweeked it for my purposes, but it wouldn't show up. Have my tweeks broken it?Here's what I added:<script type="text/javascript"> emailDAO=('name@' + 'host.' + 'com'); emailInfo=('name2@' + 'host.' + 'com'); document.write('<a href="mailto:' + emaiDAO + '">General Inquiries</a><br /> <a href="mailto:' + emaiInfo + '">Media Relations</a><br /> <a href="mailto:' + emaiDAO + '">Sponsor Relationships</a><br /> <a href="mailto:' + emaiDAO + '">Special Projects</a><br />'); </script>

Link to comment
Share on other sites

this works

<script type="text/javascript">emailDAO='name@' + 'host.' + 'com';emailInfo='name2@' + 'host.' + 'com';document.write(  '<a href="mailto:' + emailDAO + '">General Inquiries</a><br />' +  '<a href="mailto:' + emailInfo + '">Media Relations</a><br />' +  '<a href="mailto:' + emailDAO + '">Sponsor Relationships</a><br />' +  '<a href="mailto:' + emailDAO + '">Special Projects</a><br />'       );</script>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...