通读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
但除了sitekey
和badge
,我不知道它们是做什么的。但它们可能大致对应于settings for v2。