javascript - Explicitly Rendering ReCaptcha - Onload Function Not Firing -
from documentation understood in order change language of recaptcha have render explicitly.
the problem is, however, it's not showing up, , onload
not called.
when try render automatically work.
here's code:
in html head: (i have tried putting @ end of body tag)
<script src="https://www.google.com/recaptcha/api.js?onload=recaptchacallback&render=explicit&hl=iw" async defer></script>
in html form:
<div id="recaptcha"></div>
javascript:
var recaptchacallback = function() { console.log('recaptcha ready'); // not showing grecaptcha.render("recaptcha", { sitekey: 'my site key', callback: function() { console.log('recaptcha callback'); } }); }
i copied code, used own site key , works.
the code used is:
<html> <body> <p>recaptcha test</p> <div id="recaptcha"></div> <script src="https://www.google.com/recaptcha/api.js?onload=recaptchacallback&render=explicit&hl=iw" async defer></script> <script type="text/javascript"> var recaptchacallback = function () { console.log('recaptcha ready'); // showing grecaptcha.render("recaptcha", { sitekey: 'site_key', callback: function () { console.log('recaptcha callback'); } }); } </script> </body> </html>
check code carefully, single character typo can stop things working.
Comments
Post a Comment