Created
December 28, 2017 17:31
-
-
Save joaomosantos/b95ddc2511b10d0d4923aff34746276e to your computer and use it in GitHub Desktop.
Google reCaptcha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Site | |
https://www.google.com/recaptcha/intro/android.html | |
// Doc | |
https://developers.google.com/recaptcha/docs/verify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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