After implementing Google ReCaptcha v2 to facilitate the registration process, I encountered an issue when users navigate to the registration page (/register) from the Homepage. The problem is that the reCaptcha fails to load in this scenario.
The script for loading Google ReCaptcha is included in layouts.master.php:
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
In the Register Component, the reCaptcha is loaded as follows:
<div class="field">
<div class="control" id="recaptcha-reg">
<div class="g-recaptcha" data-sitekey="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"></div>
<span v-if="regErrors.captcha" v-for="error in errors">{{ error }}</span>
</div>
</div>
It's worth mentioning that the reCaptcha validation is carried out using PHP, with no JavaScript logic involved. Any assistance on resolving this issue would be greatly appreciated!