but if I then pass `document.querySelector('#turnstile-container')` as the argument I get `Turnstile

but if I then pass document.querySelector('#turnstile-container') as the argument I get TurnstileError: [Cloudflare Turnstile] Invalid type for parameter "container", expected "string" or an implementation of "HTMLElement".
14 Replies
mrmachine
mrmachineOP•11mo ago
so what exactly is the first argument to .render() supposed to be? i see... passing a string selector blows up if the selector does not match any element currently in the DOM... so I have to use assign the result of document.querySelector() to a var then check if that var is truthy before calling .render()... but turnstile probably should not blow up like that when the given selector string does not match any element 🤷
ganey
ganey•11mo ago
Happens for quite a few users here https://users.nexusmods.com/auth/sign_in
mrmachine
mrmachineOP•11mo ago
that URL just rendered 1 widget on first load but 2 widgets on reload... I also just seen my own local dev site start to render 2 widgets... I am explicitly calling .render() to load the widget on my local dev site
kian
kian•11mo ago
I see https://challenges.cloudflare.com/turnstile/v0/api.js?onload=_turnstileCb but also $(document).on('turbolinks:load', _turnstileCb). In effect, that's two different onload callbacks for rendering the widget
kian
kian•11mo ago
No description
kian
kian•11mo ago
(after removing the onload query param) I'd suggest removing the onload query param from the api.js script tag since I assume the turbolinks:load could be a different event which you prefer the timing of.
mrmachine
mrmachineOP•11mo ago
the docs mention combining explicit and onload methods but (maybe I missed it) then only gives examples of doing one or the other... in both examples .render() is called explicitly... is onload just explicit + an onload event? so is there even a need for explicit & onload in combination?
Unknown User
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
Swati
Swati•10mo ago
@Cloudflare (Dev) Any update??
Unknown User
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
sarah
sarah•10mo ago
You can find a solution to the iOS app webview here! https://github.com/marsidev/react-turnstile/issues/60
NotNot
NotNot•10mo ago
I love turnstile it’s the best
Spark
Spark•10mo ago
turstile is taking longer loading time than yesterday what could possible cause this? my internet is fine
Stingo
Stingo•10mo ago
not really

Did you find this page helpful?