Saturday 8 January 2011

Stopping Spambots

All the following is the text from the webpage www.RichsWebArchive.com/aboutthissite/stoppingsmapbots/index.php and it reads as though you are viewing the actual page:

I was concerned about Spambots (evil programs which search web pages for email addresses so they can send you spam) harvesting my email address from the pages on the site.

(added 15.01.2011 - This method has been superseded by the new Pop-up Mail Form.)

I didn't want to do anything too complex just yet using forms or scripts. So the following line of code has made it's way into my site:
< a href='mailto:rich"_at_"richswebarchive"com
?subject=Site Objectives' title='replace "_at_"  
with the at sign and " with a dot.'> 
Send me a message about this page </a>
It looks more complex than it is. the mailto: address is enclosed in single quotes allowing you to pass through the double quotes inside them to the mail client. The user must then edit the email address as per the instructions in the title part of the tag - replace "_at_" with the at sign and " with a dot.

The text in the title part of the tag also shows up as a tool-tip when you hover over the link.
Hopefully anyone reading my site will be savvy enough to deal with this and the double quotes in the email address that gets passed to the mail client should be enough to fool the spambots into ignoring my address.

I fiddled with the CSS for mailto links with the following line:
a[href^="mailto"]:hover:after { 
content: " > please edit address"; }
This adds the text > please edit address after the link when the mouse rolls over the link. I also used the a[href^="mailto"]: selector to set the various colour states for the mailto tag as these are not set when you set the colours for normal links.

Once again, all the preceding text is from the webpage www.RichsWebArchive.com/aboutthissite/stoppingspambots/index.php and it reads as though you are viewing the actual page:

No comments:

Post a Comment

keep it nice now