Search.../

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): void
handler: function TimeoutHandler(): void

onTimeout Parameters

NAME
TYPE
DESCRIPTION
handler

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:

void

TimeoutHandler Parameters

This function does not take any parameters.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Register a callback to run when a timeout occurs

Copy Code
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} );