fakeCAPTCHA
English 简体中文 Light Dark Follow browser

Usage

This page will show you how to use fakeCAPTCHA.

Import Resources

Add the following code to the
<head>
tag of the page.
<link rel="stylesheet" href="https://fakecaptcha.netlify.app/fakeCAPTCHA/fakeCAPTCHA.css">
<script src="https://fakecaptcha.netlify.app/fakeCAPTCHA/fakeCAPTCHA.js"></script>
Copy

Create

Add the following code where you want to place the CAPTCHA. In the next step, this element will be initialized as a CAPTCHA.

(The
id="captcha"
is an example attribute that you can modify.)
<div id="captcha"></div>
Copy

Customize

Use the following code to customize and initialize your CAPTCHA.
<script>
    var config = {
        element: "#captcha",
        textBefore: "I'm not a robot",
        textDuring: "Verifying...",
        textAfter: "Success",
        duration: 2000,
        success: true,
        dark: false
    };
    captcha = new CAPTCHA(config);
</script>
Copy

View example
keyboard_arrow_down
I'm not a robot
fakeCAPTCHA
I'm not a robot
fakeCAPTCHA



Parameters

Name Type Description
element string CSS selector for CAPTCHA element.
textBefore string Text displayed before verification.
textDuring string Text displayed during verification.
textAfter string Text displayed after validation.
duration number Verification duration time (in milliseconds).
success boolean Whether verification is successful.
dark boolean Whether CAPTCHA is displayed in dark theme.

Get State

The
checked
property of the CAPTCHA reflects its state. When verification is not started or is in progress, its value is
false
; Otherwise, it is
true
(regardless of whether the verification is successful or not).
<button onclick="alert(captcha.checked);">Get state</button>
Copy

View example
keyboard_arrow_down
I'm not a robot
fakeCAPTCHA
Get state




Generate Code

Use the tool below to quickly generate all the code.
Success Failure Light Dark Generate

Made by Burger Studio.
Theme: MDUI
Copied to clipboard Please enter a valid value
Close