Last active
September 23, 2016 21:53
-
-
Save AdamDenoon/2e4f4a34d84d5e76fd366fdabff8697c to your computer and use it in GitHub Desktop.
Multiple reCAPTCHA Support
This file contains hidden or 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
<div id="recap1"></div> | |
<div id="recap2"></div> | |
<script type="text/javascript"> | |
// Support for multiple reCAPTCHAs | |
var verifyCallback = function(response) { | |
alert(response); | |
}; | |
var widget1; | |
var widget2; | |
var onloadCallback = function() { | |
// Renders the HTML element with id 'example1' as a reCAPTCHA widget. | |
// The id of the reCAPTCHA widget is assigned to 'widgetId1'. | |
widget1 = grecaptcha.render('recap1', { | |
'sitekey' : "<%= ENV['recaptcha_public_key'] %>", | |
'theme' : 'light' | |
}); | |
widget2 = grecaptcha.render('recap2', { | |
'sitekey' : "<%= ENV['recaptcha_public_key'] %>", | |
'theme' : 'light' | |
}); | |
}; | |
</script> | |
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment