【问题标题】:How do I hide Google reCAPTCHA v3 from my site?如何从我的网站隐藏 Google reCAPTCHA v3?
【发布时间】:2019-04-06 03:59:54
【问题描述】:

我刚刚从 v2 升级,css 不再是从我的 UI 中隐藏 recaptcha 徽章的有效选项。这可以用 JavaScript 完成吗?

【问题讨论】:

    标签: recaptcha recaptcha-v3


    【解决方案1】:

    您可以通过递归和requestAnimationFrame 来实现这一点。

    尝试创建这样的东西:

    function hideRecaptcha() {
        const recaptcha = $(".grecaptcha-badge");
        if (recaptcha.length) return recaptcha.css({ display: "none" });
        requestAnimationFrame(() => this.hideRecaptcha());
    }
    

    然后在加载recaptcha 脚本后立即调用hideRecaptcha()

    【讨论】:

    【解决方案2】:

    您应该将其设置为 visibility: none,因为如果您使用 display none 并完全删除它,它可能会中断垃圾邮件检查。

    请看这里。 How to hide the Google Invisible reCAPTCHA badge

    【讨论】:

      猜你喜欢
      • 2017-11-16
      • 1970-01-01
      • 2022-01-19
      • 1970-01-01
      • 2017-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多