XHTML Strict 1.0 valid reCaptcha

I’m currently working on a web which uses a contact form. To avoid Spam, I use reCaptcha which is a very good Captcha system (even better than the one I used for the blog comments). You can see it in action in the contact form of this blog.

The problem with the default reCaptcha output is that it does not validates XHTML 1.0 Strict because the use of iframes. But you can change the code at the recaptchalib.php file (available here). This problem persist at the current version (1.10 at this moment).

Replacing the code at lines #122 – #128 with:
[code lang=”php”]

will do the trick 😉


10 Replies to “XHTML Strict 1.0 valid reCaptcha”

  1. Torin Finnemann Jensen

    Did you test it with javascript turned off? I’m not sure if it is due to other customization in my recaptcha setup, but the original code had these lines:

    Without them, the user missed a field to post his response in on my site, when not having javascript enabled… The following works for me:
    return ‘

    Thanks for the patch though.!


    Like or Dislike: Thumb up 0 Thumb down 0

  2. craftymomma

    😛 Thank you, Thank you! I’ve been looking for this all night. Now I can really tell my client that his site is strict xhtml. Works great.

    For anyone changing the theme using the code on the recaptcha wiki be sure to add the java script type to the script tag. As it will cause an error.



    Like or Dislike: Thumb up 0 Thumb down 0

  3. Boriel

    Hi, Steven.

    I’m sure. I’m not using it on this blog contact form (this is done by Deko Boko plugin), but on another site and it validates XHTML strict.

    Perhaps the <script> tag should be closed with </script>. Can you test it?

    Like or Dislike: Thumb up 0 Thumb down 0

Comments are closed.