JavaScript
Article

HoneyPot Captcha

By Sam Deering

honey-pot

Interesting Idea for a Captcha, this is how it works. Create a honeypot form field that should be left blank and then use CSS to hide it from human users, but not bots. The bot will fill in the input thinking it’s a proper field but user won’t (it will be hidden and hence remain blank).

Now in your code, you can just check to make sure that the honeypot field is blank.

if($('#honeypot-div input').val() == '') {
	//is human
} else {
	//probably a bot (unless a auto fill script was run)
}

It’s kind of like the invisible captcha idea but it really simple to implement. PS – I haven’t yet tried this out it’s just an idea but if anyone has tried it before can you let me know how it was any good?

  • Sebastian Becker

    The idea is good and works. But: Bots usually don’t understand JavaScript, so it doesn’t make sense to test with JavaScript. Naming the field “honeypot” might also be a little bit too obvious …

    • jquery4u

      @Sebastian – Totally agree, naming the field “honeypot” is a bad idea! It was just used for the example.

  • Pingback: CAPTCHA für Suchmaschinen - Webworking()

  • gary

    Hi great work, does anyone know of the working code for asp to use, we don’t have php on our server hosting? Already have a working form that calls an asp page to send email and redirect to thanks.asp page but cant workout where I need to add the hidden field code?

    Thanks

  • Coach

    Simple and Efficient. Great.

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in JavaScript, once a week, for free.