Google reCAPTCHA: how to get user response and validate in the server side

后端 未结 4 2047
一整个雨季
一整个雨季 2020-12-02 13:26

I am doing a Java (JSP + Servlet) web application (I understand that this question is technology-independent). I hope to use the latest Goolge reCAPTCHA service.

I a

4条回答
  •  北海茫月
    2020-12-02 13:57

    Hi curious you can validate your google recaptcha at client side also 100% work for me to verify your google recaptcha just see below code
    This code at the html body:

     

    This code put at head section on call get_action(this) method form button:

    function get_action(form) {
    
    var v = grecaptcha.getResponse();
    if(v.length == 0)
    {
        document.getElementById('captcha').innerHTML="You can't leave Captcha Code empty";
        return false;
    }
     if(v.length != 0)
     {
        document.getElementById('captcha').innerHTML="Captcha completed";
        return true; 
     }
    }
    

提交回复
热议问题