W
W
wd-3152020-06-08 08:27:40
Google
wd-315, 2020-06-08 08:27:40

Why can there be a long loading of the page with google recaptcha?

There are three forms on the site, Google captcha is connected to them.
For something very long it is executed according to Google's speedometer, what could be wrong?
Maybe something is wrong in the js code connection?

5eddcbb4cfd49976711522.png

captcha v2 (hidden)

<?if(!empty($GLOBALS['FORMS_ID'])):?>
        <script type="text/javascript">

        <?foreach ($GLOBALS['FORMS_ID'] as $formID):?>
        	var idCaptcha<?=$formID?>;
        <?endforeach;?>
        
        var onloadReCaptchaInvisible = function() {
        
        	<?foreach ($GLOBALS['FORMS_ID'] as $formID):?>
                idCaptcha<?=$formID?> = grecaptcha.render('recaptcha<?=$formID?>', {
                    "sitekey": "<?=PUBLIC_KEY_GOOGLE_CAPTCHA_V2_HIDDEN?>",
                    "callback": "onSubmitReCaptcha<?=$formID?>",
                    "size": "invisible"
                });
            <?endforeach;?>
        };
        <?foreach ($GLOBALS['FORMS_ID'] as $formID):?>
        function onSubmitReCaptcha<?=$formID?>(token) {
          var idForm = 'form_<?=$formID?>';
          sendForm(document.getElementById(idForm), idCaptcha<?=$formID?>);
        }
        <?endforeach;?>
        </script>
        
        <script src="https://www.google.com/recaptcha/api.js?onload=onloadReCaptchaInvisible&render=explicit" async defer></script>
    <?endif;?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
profesor08, 2020-06-08
@profesor08

After the update, something is wrong with Google speedometer for a long time.
Here, try Optimized .htaccess for Google PageSpeed ​​Insights
You can google the same for nginx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question