Comments (12)
Hello! For now this is not possible. But it is something that's been on my radar for some time. Now that someone else needs it, I'll consider bringing next release to life quicker :) See below as to why this has been put on hold
The problem behind this is that it will require unloading the current reCAPTCHA files, loading new ones, and resetting reCAPTCHA in between. This, of course, will affect the page load speed, which could have been avoided by using reCAPTCHA language detection feature.
Could you elaborate on why do you need such capability, please?
from ng-recaptcha.
We have a form for registering a user with the captcha. The first field is a dropdown for selecting the language and the business people want the whole page translated when I switch that language..
from ng-recaptcha.
Alright, so before this lands in the lib, here's a plunker that shows how you could leverage a custom See below as to why this has been put on holdRecaptchaLoader
for this purpose
from ng-recaptcha.
@csentis , btw there is an updated plunker for dynamic language change.
Unfortunately after careful consideration I've decided to not pursue this feature for now. That is because of the bugs that are outside of my control (i.e. recaptcha cleanup/scheduled tasks). Code samples that are referenced through plunker can be used at your own risk, consider them being a jump start rather than a part of the lib :)
To conclude, this use-case was apparently not included in the initial reCAPTCHA design, but you can still rely pretty safely on its automatic language recognition. Indeed, if the user chooses to see your web app in language X, but has their browser configured to use language Y - well, they should be prepared to be seeing both languages from time to time.
from ng-recaptcha.
I'm trying to implement this plunker using angular-cli but running into an issue.
Property 'ng2recaptchaloaded' does not exist on type 'Window'.
in the provider.
The code works just fine in Plunkr, but when trying to run using angular-cli and webpack this occurs. Any ideas?
from ng-recaptcha.
This is typescript warning you that such a property does not exist on type window. That's why the sources have this file. What's the environment you're running this in? How did you install ng-recaptcha
?
from ng-recaptcha.
Installed using npm i ng-recaptcha --save
. Not sure I understand what you mean by environment. I'm running this locally using ng serve
.
from ng-recaptcha.
what I cold suggest to you is copying the three-line file that I referenced and putting it near your custom provider file. This should fix the error
from ng-recaptcha.
That was it! Thanks for your help.
from ng-recaptcha.
At least for me on [email protected] and [email protected], the window
-issue is back (despite the interface).
What helped me was ngx-window-token, which uses an InjectionToken-based approach.
Other than it's plunker suggests, I had to tweak the use of it a bit:
- Imported
WindowTokenModule
inAppModule
, - imported
WINDOW
in (the loader) service (for a language-aware reCAPTCHA based on your plunker), - put
@Inject(WINDOW) private _window: any
into constructor.
See also maxisam/ngx-window-token#2.
from ng-recaptcha.
@DethAriel Thanks for this library!
Could you help me with your plunker mentioned above?
In the constructor of the component in which I have the reCAPTCHA embedded, I also happen to have a subscription to events that indicate whether the language has changed. That subscription should also call updateLanguage()
. It does, however, once the subscription is initialized, it calls updateLanguage
and rightly complains that the script area is not empty.
This might possibly also be a use case for the next version of your lib? Can you already guestimate when this could be due?
Christian
from ng-recaptcha.
Thanks, mate, will look into it and fully understand especially the cleanup part :)
from ng-recaptcha.
Related Issues (20)
- ng-recaptcha _502-gateway issue HOT 1
- Angular v16 support HOT 10
- Getting accessibility issue using JAWS screen reader when using recaptcha v2 sitekey HOT 6
- There is no way to know if a user pressed escape on the puzzle HOT 1
- What is the recommended way to load recaptcha when site key comes from back-end HOT 4
- Invalid site key or not loaded in api.js HOT 2
- Invisible using overloaded submit loses token and doesn't recover HOT 3
- Help!!!
- No way to make v3 invisible HOT 2
- Add support for Trusted Types HOT 1
- Cannot vertically scroll images in recaptcha on mobile popup HOT 1
- Can't bind to 'siteKey' since it isn't a known property of 're-captcha' HOT 3
- Feature Request Support for WAF HOT 1
- Standard Angular Standalone app giving NullInjectionError: R3InjectorError error HOT 2
- Upgrade to Angular 17? HOT 6
- Angular v17 Support HOT 1
- How to handle errors on older Angular and ng-recaptcha versions
- Issue with Recaptcha Loading
- Chrome Issue: recaptcha Reading cookie in cross-site context will be blocked in future Chrome versions
- Angular 18 Support HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-recaptcha.