Skip to content

Instantly share code, notes, and snippets.

@joaomosantos
Created December 28, 2017 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaomosantos/b95ddc2511b10d0d4923aff34746276e to your computer and use it in GitHub Desktop.
Save joaomosantos/b95ddc2511b10d0d4923aff34746276e to your computer and use it in GitHub Desktop.
Google reCaptcha
// Site
https://www.google.com/recaptcha/intro/android.html
// Doc
https://developers.google.com/recaptcha/docs/verify
// Script
<script src='https://www.google.com/recaptcha/api.js?hl=pt-BR' async defer></script>
// HTML
<div class="g-recaptcha" data-sitekey="your-site-key" data-callback="onRecaptcha" data-expired-callback="onRecaptchaExpired"></div>
// JS
var onRecaptcha = function() {
// code
};
var onRecaptchaExpired = function() {
// code
//grecaptcha.reset();
};
// Script
<script src='https://www.google.com/recaptcha/api.js?hl=pt-BR&onload=onloadCallback&render=explicit' async defer></script>
// HTML
<div id="gCaptchaKey"></div>
// JS
var onRecaptcha = function() {
// code
};
var onRecaptchaExpired = function() {
// code
//grecaptcha.reset();
};
var onloadCallback = function() {
grecaptcha.render('gCaptchaKey', {
'sitekey': 'your-site-key',
'callback': onRecaptcha,
'expired-callback': onRecaptchaExpired
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment