appleboy/react-recaptcha

reCAPTCHA couldn't find user-provided function: onloadCallback

ochanje210 opened this issue ยท 10 comments

I have followed Explicitly render the reCAPTCHA widget and having the following message:

reCAPTCHA couldn't find user-provided function: onloadCallback

I've had the same issue and found two solutions:

  1. Add the onloadCallback function to window
  2. Remove the onload=onloadCallback part from the query string of the script you included in index.html

I had the same problem started from these few days. It solved by @razvansandu comments. thanks.

Maybe try making it more modern and react-way and use my new React reCAPTCHA wrapper library. I think you'll feel much better with it ๐Ÿ˜„ ๐Ÿš€

Library: https://github.com/sarneeh/reaptcha
Example: https://sarneeh.github.io/reaptcha/

Hello razvansandu
I have a question
I have an issue like ochanje210.
Could you explain your solution 1 in more detail?
what is window?
How do i have to add onloadCallback?
please tell me about it in detail
Thanks

I've found a solution: just pass onloadCallback to the component, even if it is sometime not necessary to handle the onload event.
version: 2.3.10

<Recaptcha sitekey="xxx" render="explicit" onloadCallback={() => console.log('loaded')} />

In your index.html you probably have this:

<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>

remove "onload=onLoadCallback"

should look like this:

<script src="https://www.google.com/recaptcha/api.js?&render=explicit" async defer></script>

That worked for me

a

Tuve el mismo problema y removiendo "onload=onLoadCallback" del Query me funciono, como lo mencionan arriba. Mi query quedo <script src="https://www.google.com/recaptcha/api.js?render=explicit" async defer></script>
:)

In your index.html you probably have this:

<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>

remove "onload=onLoadCallback"

should look like this:

<script src="https://www.google.com/recaptcha/api.js?&render=explicit" async defer></script>

That worked for me

I had this loading in as <script src="https://www.google.com/recaptcha/api.js" async defer></script> and adding ?&render=explicit to the src worked for me. Thanks for this, I've been looking for a solution (using jQuery) for ages.

brother just replace your script with this ๐Ÿ’ฏ

<script src="https://www.google.com/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit" async defer> </script>