Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google reCAPTCHA v3 bottomleft

Reading through the code at https://www.gstatic.com/recaptcha/api2/v1531759913576/recaptcha__en.js there are numerous references to bottomleft (as opposed to bottomright where the icon is generally placed, I presume).

But how do I enable this setting and move the icon to the bottom left?

like image 606
SColvin Avatar asked Dec 23 '22 05:12

SColvin


1 Answers

just worked this out. You need:

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

Then load the script as https://www.google.com/recaptcha/api.js?onload=_grecaptcha_callback.

With this the way you call execute has to change slightly to simply

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

eg. 0 instead of the site key as the first argument.

Looking through the code there are a number of other undocumented settings:

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

But apart fromt sitekey and badge I don't know what they do. But they probably correspond roughly to the settings for v2.

like image 55
SColvin Avatar answered Dec 30 '22 06:12

SColvin