Google ReCAPTCHA v3左下角Google、ReCAPTCHA

2023-09-04 01:41:29 作者:野兽迷情

通读https://www.gstatic.com/recaptcha/api2/v1531759913576/recaptcha__en.js处的代码时,有许多对bottomleft的引用(我假设与图标通常放置的bottomright相反)。

但如何启用此设置并将图标移动到左下角?

推荐答案

指纹 人脸 声纹 虹膜 静脉识别均被破解,哪种生物识别才安全

刚刚解决了这个问题。您需要:

window._grecaptcha_callback = () => {
  window.grecaptcha.render({
    sitekey: grecaptcha_key,
    badge: 'bottomleft',
  })
  window.grecaptcha.ready(() => {
    // grecaptcha is ready
  })
}

然后将脚本加载为https://www.google.com/recaptcha/api.js?onload=_grecaptcha_callback

这样,您调用Execute的方式必须稍微更改为简单

window.grecaptcha.execute(0, {action})

0而不是站点密钥作为第一个参数。

浏览代码时,还有许多其他未记录的设置:

sitekey, type, theme, size, tabindex, stoken, bind, preload, badge, s, pool, 'content-binding', action

但除了sitekeybadge,我不知道它们是做什么的。但它们可能大致对应于settings for v2。