1
Hello, I am trying to insert a recaptcha on a page, I managed to successfully insert into the contact page through a form in AJAX.
The problem is in an AJAX form that is inside a lightbox (In this case I use featherlight but I don’t think it influences), I add everything right, but when I click on "I’m not a robot" it keeps loading and returns the following error in the console:
Uncaught Domexception: Blocked a frame with origin "www.google.com" from accessing a cross-origin frame. At kp.f.Yb (www.gstatic.com/recaptcha/api2/r20170411114922/recaptcha__pt_br.js:347:353) At kp.xb (www.gstatic.com/recaptcha/api2/r20170411114922/recaptcha__pt_br.js:343:59)
My code:
1st Form:
<form action="envia_franquias.php" method="post" id="form_franquias">
<input type="text" name="nome" id="nome" placeholder="Nome Completo:" required>
<input type="tel" name="telefone" id="telefone" placeholder="Telefone/Celular:" required>
<input type="email" name="email" id="email" placeholder="E-mail:" required>
<input type="text" name="cidade" id="cidade" placeholder="Cidade:" required>
<input type="text" name="estado" id="estado" placeholder="UF" required>
<textarea name="mensagem" id="mensagem" placeholder="Comentários:"></textarea>
<div id="captcha"></div>
<input type="submit" value="Enviar" id="submit" class="btn_send">
</form>
2º Js:
<script>
var widgetId2;
var onloadCallback = function() {
widgetId2 = grecaptcha.render('captcha', {'sitekey' : '6LffYh0UAAAAAA8CJ7p7gmOtc3Cr_gAjqVDTNFYL'});
};
$(".btn_franquias a").click(function() {
setTimeout(function() {
createRecaptcha();
}, 1000);
});
function createRecaptcha() {
grecaptcha.reset(widgetId2);
}
</script>
<script src="//www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
I already tried to put the src script with http start
I tried to put the render in a setTimeOut
I couldn’t find anything else on the Internet, someone could help?