Invisible CAPTCHA (beta)
Invisible CAPTCHA provides seamless bot protection without interrupting the user experience. The CAPTCHA challenge runs in the background and only presents a visible challenge if additional verification is needed.
Invisible CAPTCHA is currently in beta. Features and behavior may change in future releases.
Invisible CAPTCHA works by:
- Running verification challenges in the background
- Analyzing user behavior and browser characteristics
- Only showing a visible challenge if the user appears suspicious
- Providing a smooth experience for legitimate users
Making a widget invisible
Section titled “Making a widget invisible”With implicit rendering, a .procaptcha element is invisible if it is a <button>. Use the button that submits the
form:
<button class="procaptcha" data-sitekey="your_site_key" data-callback="onCaptchaSuccess"> Submit</button>Any other .procaptcha element, such as a <div>, renders a visible widget. With explicit rendering, pass
size: 'invisible' to render() (see Explicit rendering).
Need a site key?
Sign up free to get a site key and secret key for your domain.
Get your site keyWhich challenge runs behind it is a property of the site key, chosen in the
Prosopo portal — see CAPTCHA Types. On a frictionless
site key most visitors complete an invisible Proof of Work and never see anything; a visitor who scores as risky is
shown a puzzle or an image challenge at the point of submission.
Implementation methods
Section titled “Implementation methods”Implicit rendering
Section titled “Implicit rendering”Add the procaptcha class and data attributes to the form’s submit button:
<!DOCTYPE html><html><head> <script type="module" src="https://js.prosopo.io/js/procaptcha.bundle.js" async defer></script> <script nomodule src="https://js.prosopo.io/js/procaptcha.bundle.iife.js" async defer></script></head><body> <form> <input type="email" name="email" required> <button type="button" class="procaptcha" data-sitekey="your_site_key" data-callback="handleSubmit" data-failed-callback="handleFailure"> Submit Form </button> </form>
<script> function handleSubmit(token) { console.log('CAPTCHA verified:', token); // Submit your form with the token }
function handleFailure() { console.log('CAPTCHA verification failed'); // Handle failure case } </script></body></html>Explicit rendering
Section titled “Explicit rendering”For more control over the CAPTCHA lifecycle:
<!DOCTYPE html><html><head> <script type="module" src="https://js.prosopo.io/js/procaptcha.bundle.js" async defer></script> <script nomodule src="https://js.prosopo.io/js/procaptcha.bundle.iife.js" async defer></script></head><body> <form id="demo-form"> <input type="email" name="email" required> <div id="procaptcha"></div> <button type="submit">Submit Form</button> </form>
<script type="module"> import { render, execute } from "https://js.prosopo.io/js/procaptcha.bundle.js"
let widgetId;
function handleCaptchaSuccess(token) { console.log('CAPTCHA verified:', token); // Process form submission with token }
function handleCaptchaFailure() { console.log('CAPTCHA verification failed'); // Handle failure }
document.addEventListener('DOMContentLoaded', async function() { // Render invisible CAPTCHA. render() is async, so await it before // using the id it resolves to. widgetId = await render(document.getElementById('procaptcha'), { siteKey: 'your_site_key', size: 'invisible', callback: handleCaptchaSuccess, 'failed-callback': handleCaptchaFailure });
// Handle form submission document.getElementById('demo-form').addEventListener('submit', function(e) { e.preventDefault(); // Trigger CAPTCHA verification. Pass the widget id to trigger only // this widget; with no argument every widget on the page runs. execute(widgetId); }); }); </script></body></html>