首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >谷歌reCAPTCHA V2 JavaScript我们检测到您的网站没有验证reCAPTCHA解决方案

谷歌reCAPTCHA V2 JavaScript我们检测到您的网站没有验证reCAPTCHA解决方案
EN

Stack Overflow用户
提问于 2018-04-01 05:51:45
回答 1查看 14.8K关注 0票数 8

错误消息我们检测到您的站点未验证reCAPTCHA解决方案。这是在您的站点上正确使用reCAPTCHA所必需的。我创建了这段reCaptcha代码,它工作得很好,但我不知道如何验证它,我以为它是用函数grecaptcha.getResponse();验证的,但事实并非如此。显然,recaptcha在网站上运行良好,但我只是在谷歌管理中看到了下一条消息:

要求: javascript 1.不要在表单中使用,只能在表单中使用action="file.php"函数。

代码语言:javascript
复制
     <!DOCTYPE>
<html>
<head >
    <title></title>
    <script src='https://www.google.com/recaptcha/api.js'></script>
    <script type="text/javascript">
        function get_action() {
            var v = grecaptcha.getResponse();
            console.log("Resp" + v );
            if (v == '') {
                document.getElementById('captcha').innerHTML = "You can't leave Captcha Code empty";
                return false;
            }
            else {
                document.getElementById('captcha').innerHTML = "Captcha completed";
                return true;
            }
        }
    </script>
</head>
<body>
    <form id="form1" onsubmit="return get_action();">
    <div>
    <div class="g-recaptcha" data-sitekey="6LdNIlAUAAAAADS_uVMUayu5Z8C0tw_jspdntbYl"></div>
    </div>
   <input type="submit" value="Button" />
   
    <div id="captcha"></div>
    </form>
</body>
</html>

你能帮我吗?请。我将非常感谢我如何验证它,因为我在提交时需要使用javascript函数onsubmit="return get_action();"而不是action="file.php" *?:

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49592772

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档