Ability to lazy load reCAPTCHA v3 site key
See original GitHub issueSummary
I’m submitting a:
- bug report
- feature request
- question / support request
- other
Description
Currently the v3 site key can only be provided by the RECAPTCHA_V3_SITE_KEY
injection token which is of type string
. It would be nice to have the ability to lazy load the site key (for example via a REST call) and assign it to the ReCaptchaV3Service
once it’s loaded.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:15
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Loading reCAPTCHA - Google Developers
This document discusses best practices for loading the reCAPTCHA script tag. This information is applicable to both reCAPTCHA v2 and v3.
Read more >Ability to lazy load reCAPTCHA v3 site key - Bountysource
Description. Currently the v3 site key can only be provided by the RECAPTCHA_V3_SITE_KEY injection token which is of type string . It would...
Read more >Improve page performance lazy loading reCaptcha
After searching online for some ways to improve the situation, I found this article which explained how to solve all my issues. The...
Read more >Improve web performance lazy loading reCaptcha
A super quick guide explaining how you can improve your Lighthouse score and overall web performance by lazy loading reCaptcha only when ...
Read more >Load reCAPTCHA dynamically - javascript - Stack Overflow
body> ; div id="captcha_container"> ; div> ; input type="button" id="MYBTN" value="MYBTN"> ; script src="https://www.google.com/recaptcha/api.js?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is now an idiomatic way to achieve that with Angular, which is using
APP_INITIALIZER
. The approach is demonstrated in this Stackblitz demo. In essence, here’s what’s being done there:Hi @DethAriel,
The idea is to conditionally load the RECAPTCHA_V3_SITE_KEY (from an API call preferably) and then useValue for the provider.
We have something similar in Angular using APP_INITIALIZER. It enables us to use a certain value from config instead of hardcoding it in the module and services.
{ provide: APP_INITIALIZER, useFactory: initApp, multi: true, deps: [ConfigService] },
Full example here