In some dynamic interfaces, you may not want to load reCAPTCHA with the initial page loaded. In others you can’t because it would expire by the time the user uses that piece of the UI.
In the above scenarios you can add reCAPTCHA just when you need it.
First include the recaptcha script:
<script type="text/javascript" src='http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'></script>
<script type="text/javascript" src='<%= Request.Url.Scheme +
"://www.google.com/recaptcha/api/js/recaptcha_ajax.js" %>'></script>
In the corresponding JavaScript action, do:
Recaptcha.create(theRecaptchaPublicKey, targetDiv);
$('#someContainer .captcha').each(function () {
Recaptcha.create(theRecaptchaPublicKey, this);
});
No comments:
Post a Comment