Answer the question
In order to leave comments, you need to log in
Recaptcha disappears after page refresh?
Good afternoon, I still can’t understand why recaptcha v2 disappears after refreshing the page.
<script type="text/javascript">
var onloadCallback = function() {
grecaptcha.render('html_element', {
'sitekey' : '6*****'
});
};
</script>
<div id="html_element"></div>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"
async defer>
</script>
Uncaught Error: ReCAPTCHA placeholder element must be an element or id
Answer the question
In order to leave comments, you need to log in
Script loaded, DOM not rendered
Need to catch the moment when recaptcha loads and DOMContentLoaded
I met with the same problem, moreover, on one page 3 recaptchas are loaded without problems in different places of the HOME, and on one page it categorically refused to load into one of the forms, although everything looks fine with loading.
I had to set a settimeout
setTimeout(function() {
captcha4 = grecaptcha.render(document.getElementById('feedbackc'), {
'sitekey' : mysitekey
});
}, 1000)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question