diff --git a/plugins/captcha/recaptcha/recaptcha.php b/plugins/captcha/recaptcha/recaptcha.php index 0b7fdda481970..3e44e7e811546 100644 --- a/plugins/captcha/recaptcha/recaptcha.php +++ b/plugins/captcha/recaptcha/recaptcha.php @@ -72,17 +72,35 @@ public function onInit($id = 'dynamic_recaptcha_1') $theme = $this->params->get('theme', 'clean'); $file = 'https://www.google.com/recaptcha/api/js/recaptcha_ajax.js'; - JHtml::_('script', $file); + JHtml::_( + 'script', + $file, + array(), + array( + 'defer' => true, + 'async' => true + ) + ); JFactory::getDocument()->addScriptDeclaration('jQuery( document ).ready(function() {Recaptcha.create("' . $pubkey . '", "' . $id . '", {theme: "' . $theme . '",' . $this->_getLanguage() . 'tabindex: 0});});'); } else { // Load callback first for browser compatibility - JHtml::_('script', 'plg_captcha_recaptcha/recaptcha.min.js', array('version' => 'auto', 'relative' => true)); + JHtml::_( + 'script', + 'plg_captcha_recaptcha/recaptcha.min.js', + array( + 'version' => 'auto', + 'relative' => true + ), array( + 'defer' => true, + 'async' => true + ) + ); $file = 'https://www.google.com/recaptcha/api.js?onload=JoomlaInitReCaptcha2&render=explicit&hl=' . JFactory::getLanguage()->getTag(); - JHtml::_('script', $file); + JHtml::_('script', $file, array(), array('defer' => true, 'async' => true)); } return true; @@ -122,6 +140,7 @@ public function onDisplay($name = null, $id = 'dynamic_recaptcha_1', $class = '' } $dom->appendChild($ele); + return $dom->saveHTML($ele); }