JavaScript APIs
MTCaptcha JavaScript APIs
A window.mtcaptcha
object will be created once the MTCaptcha JavaScript library has loaded. This mtcaptcha
object supports the following APIs.
API | Description |
---|---|
enableTestMode() | To enable Automated Test mode with the TestKey. For more details, see Developers Guide - Automated Testing. |
getConfiguration() | Returns a 'copy' of the configuration object for the captcha. This is primarily used for debugging config settings. Any changes to the returned config object are ignored. |
getStatus() | Returns the current state of the captcha. For more details of the state object, see Developers Guide - JS Callbacks - State Argument. |
getVerifiedToken() | Returns the current verifiedToken string, null if not verified. |
renderUI() | Explicit call to render the captcha, when initialized with config render='explicit' . See Developers Guide - Explicit Render for asynchronous safe method explicitly render the widget. |
resetUI() | Resets the widget and all its state. |
remove() | Completely removes the captcha widget from the DOM. The captcha can be re-instantiated by calling renderUI() . This method is useful for single-page web applications. |
showMandatory() | Shows the message and styling to indicate the captcha is mandatory. This is intended for use with custom form validation. See Developers Guide - Auto Form Validate to have the captcha automatically check and enforce completion on form submit. |