and ...">

Google REcaptcha not showing

In my <body>

there is the following:
 <div class="g-recaptcha" data-sitekey="some-key (original is right)"> 

and this is on my <head>

 <script src="//www.google.com/recaptcha/api.js"></script> 

but nothing is displayed either on firefox or chrome ... Is this a known issue?

+5
source share
6 answers

make sure that <script src="//www.google.com/recaptcha/api.js"></script> is the last thing you need before closing the title tag. This fixed problem for me

+3
source

Just hit this obstacle, and in my case it was related to AngularJS. It is not limited to Angular, any library that links elements after the page loads can cause Google reCAPTCHA to not display, since the element simply does not exist at the time the Google code is executed.

To solve this problem, first make the rendering explicit and pass the function that executes when reCAPTCHA loads:

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

Now add a unique identifier to the container, for example.

 <div id="recaptcha" class="g-recaptcha" data-sitekey="site key here"></div> 

Then, in the user-defined function, waiting for the element to exist:

 var _captchaTries = 0; function recaptchaOnload() { _captchaTries++; if (_captchaTries > 9) return; if ($('.g-recaptcha').length > 0) { grecaptcha.render("recaptcha", { sitekey: 'site key here', callback: function() { console.log('recaptcha callback'); } }); return; } window.setTimeout(recaptchaOnload, 1000); } 

This will continue for 10 seconds until it finds an item and then displays reCAPTCHA in it.

+1
source

Make sure that content blocking, such as Ad-Block Plus or uBlock origin, is activated in your browser.

Disable them, refresh the page and submit the form again.

0
source

The problem was that it showed most of the time, but sometimes it wasn’t, and I would have to submit a form (and run a validation) to show it. Adding ?render=explicit to the script tag fixed it for me.

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

https://developers.google.com/recaptcha/docs/display#explicit_render

0
source

I just had this on a system with stricter browser settings.
Adding *.gstatic.com to the trusted list enabled it

I also added *.google.com and *.google-analytics.com

Hope someone help

-2
source

Edit:

 <script src="//www.google.com/recaptcha/api.js"></script> 

in

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

I do not know if it will be just a typo, if it is not, adding https: will certainly solve your problem.

-3
source

All Articles