tanveery / recaptcha-net

reCAPTCHA for .NET library lets you easily use Google's reCAPTCHA in an ASP.NET Web Forms / MVC / ASP.NET Core application.
Apache License 2.0
163 stars 69 forks source link

Added fix for #7 (option to disable script tag rendering). #39

Closed AlissonRS closed 3 years ago

AlissonRS commented 7 years ago

With this, we can now use two recaptchas in the same page.

Inside of the tag, manually load the api script:

<script src="https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit" async defer></script>

Then in the bottom of the page, insert this javascript to manually render recaptchas:

<script type="text/javascript"> var CaptchaCallback = function() { $('.g-recaptcha').each(function(index, el) { grecaptcha.render(el, {'sitekey' : 'your_key'}); }); }; </script>

Then insert as many repactchas as you wish with this:

@Html.Recaptcha(renderApiScript: false)