Recaptcha: reCAPTCHA not rendering until refresh

Created on 26 Apr 2018  路  9Comments  路  Source: google/recaptcha

Recently (today) we noticed the reCAPTCHA would not load on the first render, but does render on a refresh.

Were there any recent changes or issues that may have changed the rendering of the reCAPTCHA?

Thanks

question widget

Most helpful comment

I am having the same issue. The recaptcha used to work fine and now it only works once and then the page needs to be refreshed...

All 9 comments

I am having the same issue. The recaptcha used to work fine and now it only works once and then the page needs to be refreshed...

We're having a very similar issue. It will load the first time, but if the user navigates to a different part of the site, then comes back to the original page, the recaptcha will not load. However, if they refresh the page it shows up again.

Just to be clear, we are using recaptcha version 2

This is my solution as my project is also experiencing this issue. The code below requires jQuery. I also had to explicitly render the recaptcha

$(document).ready( function(){
    setTimeout(function(){
        if($('#DIV_ID').children().length === 0) {
            grecaptcha.render('DIV_ID', {
                'sitekey' : 'YOUR_SITE_KEY', 
                'callback' : recaptchaCallback
            });
        }
    }, 500);
});

The UI for my project actually has 4 recaptchas implemented, however only one of them is experiencing this loading issue.

We did the exact same thing (conceptually), but I don't like the solution as it feels very "hacky." We were hoping Google could provide some insight as to why it's happening and/or patch the problem so we don't have to use this solution.

The above issue is tied to reCaptcha v2 and also noticed sites such as Reddit no longer have an explicit reCaptcha on login or registration just recently.

Even with the above there seems to be little to no information regarding this issue elsewhere including the google forums (https://groups.google.com/forum/m/#!forum/recaptcha).

I am having the same issue. The reCaptcha is not rendering until refresh, in incognito mode.

We are also seeing a failure for the reCaptcha to load on an existing site where it has been working for more than a year. We are getting the following console error:
reCAPTCHA couldn't find user-provided function: checkForReCaptcha

We are getting this error now which has been working for long time.

Uncaught TypeError: (intermediate value)(intermediate value).push is not a function

This isn't directly related to the PHP code which is what this repo focuses on. However, you might want to look at the v3 support in the most recent release. That uses a wholly invisible reCAPTCHA that just returns a confidence score for the request. This might alleviate some of your issues. Example hosted at https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php

Was this page helpful?
0 / 5 - 0 ratings