Google reCAPTCHA Implementation using Javascript - ASP TANMOY

Latest

Thursday 28 April 2016

Google reCAPTCHA Implementation using Javascript

What is reCAPTCHA?
reCAPTCHA is a free service that protects your website from spam and abuse. reCAPTCHA uses an advanced risk analysis engine and adaptive CAPTCHAs to keep automated software from engaging in abusive activities on your site. It does this while letting your valid users pass through with ease.


reCAPTCHA offers more than just spam protection. Every time our CAPTCHAs are solved, that human effort helps digitize text, annotate images, and build machine learning datasets. This in turn helps preserve books, improve maps, and solve hard AI problems.

Step 1

Login to google reCAPTCHA

Step 2

Enter You domain name and register


Step 3 

Copy your site key and use it in bellow code.

CODE
<html>
<head>
<script type="text/javascript" language="javascript">
function validateform(){
var captcha_response = grecaptcha.getResponse();
if(captcha_response.length == 0)
{
    // Captcha is not Passed
    return false;
}
else
{
    // Captcha is Passed
    return true;
}
}
</script>
</head>
<body>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js"></script></pre>
<form action="" method="post" onsubmit="return validateform();">
<div class="g-recaptcha" data-sitekey="SITE_KEY"></div>
 <input type="submit" value="Submit" /></form>
<pre>
</body>
</html>

No comments:

Post a Comment