ReCaptcha v2客户端事件 [英] ReCaptcha v2 client side events
问题描述
如果没有这个,用户可以点击复选框,然后在验证码响应返回之前快速点击提交按钮。
我可以将我自己的点击事件处理程序添加到类 recaptcha-checkbox-checkmark
并轮询tick的可见性,我只是想知道是否有更简单的方法吗?
$(。recaptcha-checkbox-checkmark)。click (function(){
//...Poll for tick
});
您可以配置reCAPTCHA以在成功验证时进行回调如果使用显式渲染,则使用g-recaptcha标记上的data-callback属性或通过'callback'参数。
请参阅
https://developers.google.com/recaptcha/docs/display#render_param
使用显式渲染的示例:
var myCallback = function(val){console.log(val); };
grecaptcha.render(
document.getElementsById('my-recaptcha-placeholder'),
{
callback:myCallback,
sitekey:mySiteKey
} );
Does ReCaptcha v2 expose any client side events? I am looking specifically to identify when the Captcha response has been returned once the box is ticked, so I can reveal the "Continue" button below.
Without this it is possible for the user to click the checkbox then quickly click the submit button before the captcha response is back.
I could possible add my own click event handler to the class recaptcha-checkbox-checkmark
and poll the visiblity of the tick, I just wondered if there was a simpler way to do this?
$(".recaptcha-checkbox-checkmark").click(function() {
//...Poll for visibility of tick
});
You can configure reCAPTCHA to give a callback on successful validation using the data-callback attribute on the g-recaptcha tag or via the 'callback' parameter if using explicit rendering.
See https://developers.google.com/recaptcha/docs/display#render_param
Example using explicit rendering:
var myCallback = function(val) { console.log(val); };
grecaptcha.render(
document.getElementsById('my-recaptcha-placeholder'),
{
callback: myCallback,
sitekey: mySiteKey
});
这篇关于ReCaptcha v2客户端事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!