Creating a 2nd Captcha before the API scripts loads causes 2nd script to load
TylerDixon opened this issue · 0 comments
TylerDixon commented
This is best explained by an example:
- User is on Page A which has a Captcha A
- Captcha A mounts, putting an API script tag on the page.
- User Navigates to Page B which has a Captcha B
- Captcha B resets the
captchaScriptCreated
flag, then mounts which places another API script tag on the page.
This is most prevalent in scenarios where the user has a slow connection. I have also created a scenario to test this out there here.
Expected Behavior
API script should only attempt to be loaded once.
Current Behavior
API script is loaded more than once.
Possible Solution
Remove the check from the constructor here, and instead update this line to be
const captchaScriptCreated = typeof hcaptcha !== 'undefined';
Workaround
Load the script with a <script>
tag before your page loads.