Answer the question
In order to leave comments, you need to log in
How to speed up page loading with multiple reCaptchas?
There are 15 popup forms on the page.
I attached an invisible recaptcha to them like this:
<script type="text/javascript">
var onloadCallback = function() {
$(".g-recaptcha").each(function() {
var el = $(this);
grecaptcha.render($(el).attr("id"), {
"sitekey" : SITE_KEY,
"callback" : function(token) {
$(el).parent().find(".g-recaptcha-response").val(token);
$(el).parent().submit();
}
});
});
};
</script>
<form>
<input type="text" name="example"/>
<button id="captcha1" class="g-recaptcha">submit form 1</button>
</form>
<form>
<input type="text" name="example"/>
<button id="captcha2" class="g-recaptcha">submit form 2</button>
</form>
<script src='https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit' async defer></script>
Answer the question
In order to leave comments, you need to log in
Alternatively, render the desired captcha only after opening the popup
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question