Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

GCaptcha and settings for API

1:32 pm on Dec 19, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1088
votes: 1

I like to know what is the best to use when implementing gCaptcha and API:
<script src='https://www.google.com/recaptcha/api.js?render=onload&amp;hl=en'></script>
<script src='https://www.google.com/recaptcha/api.js?hl=en&onload=MYscript&render=explicit" async defer'></script>

render=explicit and async defer or without?
3:16 pm on Jan 3, 2018 (gmt 0)

Administrator from US 

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 21, 1999
posts: 38193
votes: 90

defer. It won't slow down other loads that way. You want the Captcha to be one of the later things loaded.
3:21 pm on Jan 3, 2018 (gmt 0)

Junior Member from CA 

Top Contributors Of The Month

joined:Mar 2, 2017
votes: 5

Scripts loaded with ASYNC are parsed and executed immediately when the resource is done downloading. Whereas DEFER scripts donít execute until the HTML document is done being parsed (AKA, DOM Interactive or performance.timing.domInteractive).

Comparing the ASYNC and DEFER waterfalls, we see that using DEFER makes DOM Interactive fire sooner and allows rendering to proceed more quickly.


Even though ASYNC and DEFER donít block the HTML parser, they can block rendering. This happens when theyíre parsed and executed before rendering is complete and take over the browser main thread. Thereís nothing in the spec that says they have to wait until rendering is complete.

Source: [calendar.perfplanet.com...]
3:11 pm on Jan 11, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1088
votes: 1

I have set Multiform Recaptcha. How to validate Google variable as positive that content can not be posted?



<title>gCaptcha and Multiforms design</title>

<form id="mycontactform1" method="post">

function IsRecapchaValid()
var res = grecaptcha.getResponse(form);
if (res == "" || res == undefined || res.length == 0)
return false;
return true;
var recaptcha1;
var recaptcha2;
var myCallBack = function() {
recaptcha1 = grecaptcha.render('recaptcha1',
'sitekey': 'XXX',
'theme': 'light'

recaptcha2 = grecaptcha.render('recaptcha2',
'sitekey': 'XXX',
'theme': 'dark'
<script src="https://www.google.com/recaptcha/api.js?hl=en&onload=myCallback&render=explicit" async defer></script>

<input type="submit" name="formsubmit1" data-callback="captchaSubmit" value="Send" class="" />



Can be improved this code as there are two captcha designs and need to pass variables into PHP variable like
$smarty->assign("gcaptcha", $gcatcha);

how to receive POST value in this case?
Need help