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
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 🤷Happens for quite a few users here https://users.nexusmods.com/auth/sign_in
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 siteI 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
(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.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•10mo ago
Message Not Public
Sign In & Join Server To View
@Cloudflare (Dev) Any update??
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
You can find a solution to the iOS app webview here! https://github.com/marsidev/react-turnstile/issues/60
I love turnstile it’s the best
turstile is taking longer loading time than yesterday
what could possible cause this?
my internet is fine
not really