onTimeout( )
Adds an event handler that runs when the CAPTCHA token expires.
Description
The onTimeout()
function allows you to perform actions when a CAPTCHA timeout occurs.
When a site visitor completes a CAPTCHA challenge, a token
is
generated. If 120 seconds pass without backend authorization,
the token expires and onTimeout()
is called.
When a timeout occurs, the reCAPTCHA element automatically resets and displays a message asking the site visitor to redo the challenge. If you enabled the clickable element for triggering a restricted operation when the CAPTCHA was verified, disable it.
Syntax
function onTimeout(handler: TimeoutHandler): voidhandler: function TimeoutHandler(): void
onTimeout Parameters
NAME
TYPE
DESCRIPTION
The name of the function or the function expression to run when a CAPTCHA timeout occurs.
Returns
This function does not return anything.
Return Type:
TimeoutHandler Parameters
This function does not take any parameters.
Returns
This function does not return anything.
Return Type:
Was this helpful?
Register a callback to run when a timeout occurs
1$w("#myCaptcha").onTimeout(() => {2 $w("#submitDataButton").disable();3 $w("#messageText").text = "The CAPTCHA has timed out. Please redo the CAPTCHA challenge.";4 $w("#messageText").show();5} );