elusive recaptcha bug. Copy code always fails
Why this happens:
This happens when the client has JavaScript disabled. Let's take a look at the following sample code.
Example code from reCAPTCHA: Tips and Guidelines API documentation:
<script type="text/javascript"
src="https://www.google.com/recaptcha/api/challenge?k=your_public_key">
</script>
<noscript>
<iframe src="https://www.google.com/recaptcha/api/noscript?k=your_public_key"
height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field"
value="manual_challenge">
</noscript>
As we can see, there are noscript
tags containing an iframe
, a textarea
, and a hidden input
. When JavaScript is disabled, it will render the contents of the noscript
tags and it will look something like this.
The iframe
contains a form where a user can enter the captcha and submit the form, upon which the iframe
will load a new page containing the response code. Since JavaScript is disabled, the only way to get that token to the parent page's form is to have the user copy-and-paste the token into the textarea
in the example.
Workaround?:
So long as the user correctly copy-and-pastes the token, it should work fine. Double-check that the HTML for the captcha contains the correct fallback elements. You can also disable JavaScript in your browser to test it yourself.