no-captcha icon indicating copy to clipboard operation
no-captcha copied to clipboard

Multiple recaptcha on same page

Open theromie opened this issue 7 years ago • 3 comments

Multiple recaptcha on same page is not showing. How can i do this?

theromie avatar May 08 '17 10:05 theromie

Just youse this for each captcha at the page if you need dynamic including:

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

    <div class="g-recaptcha"></div>

    <script>
        var onloadCallback = function() {
            //remove old
            $('.g-recaptcha').html('');

            $('.g-recaptcha').each(function (i, captcha) {
                grecaptcha.render(captcha, {
                    'sitekey' : 'your key'
                });
            });
        };
    </script>

But it is slow. You can also define all recaptchas at page initially: https://developers.google.com/recaptcha/docs/display

loburets avatar Jul 26 '17 12:07 loburets

Check my version, work with Multiple recaptcha. https://github.com/dosarkz/no-captcha

dosarkz avatar Sep 28 '17 04:09 dosarkz

This does the trick for me, no jquery dependency, ie9+:

  {!! NoCaptcha::renderJs('en', true, 'recaptchaCallback') !!}

  <script>
    function recaptchaCallback() {
      document.querySelectorAll('.g-recaptcha').forEach(function (el) {
        grecaptcha.render(el);
      });
    }
  </script>

ozanhazer avatar Nov 22 '17 06:11 ozanhazer