I get the error "Error: No reCAPTCHA clients exist" when navigating from another page to the page with the reCaptcha. It works fine if I land directly on the reCaptcha page, but not if navigating from another page.
I think the issue is that the reCaptcha script loads before the container has been added to the DOM. It's fixable by loading reCaptcha with the "explicit" flag: https://www.google.com/recaptcha/api.js?render=explicit, and then calling grecaptcha.render("some-container-id") inside onMount().
@kermado
I am using it like this in my svelte kit project
<ReCaptcha
bind:this={Captcha}
{SITE_KEY}
captchaStyle={{ theme: 'dark', size: 'compact' }}
/>
I get the error "Error: No reCAPTCHA clients exist" when navigating from another page to the page with the reCaptcha. It works fine if I land directly on the reCaptcha page, but not if navigating from another page.
I think the issue is that the reCaptcha script loads before the container has been added to the DOM. It's fixable by loading reCaptcha with the "explicit" flag:
https://www.google.com/recaptcha/api.js?render=explicit
, and then callinggrecaptcha.render("some-container-id")
insideonMount()
.