ReCaptcha v2 client side events

前端 未结 2 1594
借酒劲吻你
借酒劲吻你 2021-02-02 07:21

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 \"

2条回答
  •  情话喂你
    2021-02-02 07:51

    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
       });
    

提交回复
热议问题