numCaptchaJS is a Javascript Library that allows you to use numCAPTCHA easily on your website.
In your index.html, numCaptcha dynamically renders in a <div>
tag with the id of captcha-wrapper
<body>
<div id="captcha-wrapper"></div>
</body>
You also need to import the minified script using a script tag
<script src="https://numcaptcha.s3.amazonaws.com/lib/numCaptchaJS/numcaptcha-js.min.js"></script>
⚠️ Remember to import numCaptchaJS after the <body> tag
After importing the script, you would have access to the useNumCaptcha()
function in the global windows
object. The function returns a promise which resolves with the value of true
when user successfully completes numCAPTCHA, else it would reject with the value of false
when user is identified as a bot.
window
.useNumCaptcha()
.then((res) => {
// do something onSuccess
})
.catch((err) => {
// do something onFailed
});
If you are using awesome VueJS, do check out numCaptchaVUE 🎉