This example demonstrates how to use Procaptcha in invisible image mode with explicit rendering.
This example demonstrates how to use Procaptcha in invisible image mode with explicit rendering:
?render=explicit
parameterdata-size="invisible"
onloadCallback
function that renders the Procaptcha widgetThe key elements are:
<script type="module" src="./assets/procaptcha.bundle.js?render=explicit" async defer></script> <div id="procaptcha-container" data-size="invisible"></div> <script> // Render the widget window.procaptcha.render('procaptcha-container', { 'siteKey': 'your_site_key', 'callback': onSubmit, 'size': 'invisible', 'captchaType': 'image' }); // Execute the verification window.procaptcha.execute(); </script>
When you click the Submit button, the execute()
function will:
procaptcha:execute
event to show the modalThis helps debug and understand how the invisible Procaptcha is structured in the DOM.
To connect the vanilla JavaScript bundle with the React components, we use a custom event system:
window.procaptcha.execute()
is called, it dispatches a procaptcha:execute
eventstate.showModal = true
This decoupled approach allows the JavaScript bundle to communicate with React components without direct references.