{"action":"opened","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/8188","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8188/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8188/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/8188/events","html_url":"https://github.com/joomla/joomla-cms/issues/8188","id":113865258,"number":8188,"title":"Recaptcha does not work when used in javascript onload event","user":{"login":"andrepereiradasilva","id":9630530,"avatar_url":"https://avatars.githubusercontent.com/u/9630530?v=3","gravatar_id":"","url":"https://api.github.com/users/andrepereiradasilva","html_url":"https://github.com/andrepereiradasilva","followers_url":"https://api.github.com/users/andrepereiradasilva/followers","following_url":"https://api.github.com/users/andrepereiradasilva/following{/other_user}","gists_url":"https://api.github.com/users/andrepereiradasilva/gists{/gist_id}","starred_url":"https://api.github.com/users/andrepereiradasilva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrepereiradasilva/subscriptions","organizations_url":"https://api.github.com/users/andrepereiradasilva/orgs","repos_url":"https://api.github.com/users/andrepereiradasilva/repos","events_url":"https://api.github.com/users/andrepereiradasilva/events{/privacy}","received_events_url":"https://api.github.com/users/andrepereiradasilva/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-28T16:46:07Z","updated_at":"2015-10-28T16:46:07Z","closed_at":null,"body":"## Steps to reproduce the issue\r\n\r\nThe recaptcha do not work if you move the javascript execution to after the javascript onload event.\r\n\r\nConfigure recaptcha plugin with version 2.0 and put it working as default in system configuration.\r\n\r\nUse any joomla plugin that allows you to move the javascript execution to after the page onload event. Load any page with the recaptcha form and see the recaptcha image does not load.\r\n\r\n## Potencial solution\r\n\r\nUse HTML5 \"data-*\" attributes when loading recaptcha.\r\n\r\nInstead of:\r\n```<script src=\"https://www.google.com/recaptcha/api.js?hl=__LANG__&amp;render=explicit\" type=\"text/javascript\">\r\n[...]\r\n<div id=\"jform_captcha\" class=\" required\">\r\n[...]\r\njQuery(document).ready(function($) {$(window).load(function() {grecaptcha.render(\"jform_captcha\", {sitekey: \"__RECAPTCHASITEKEY__\", theme: \"__RECAPTCHATHEME__\"});});})```\r\n\r\nUse:\r\n```<script src=\"https://www.google.com/recaptcha/api.js?hl=__LANG__&amp;render=onload\" type=\"text/javascript\">\r\n[...]\r\n<div id=\"jform_captcha\" class=\"g-recaptcha required\" data-sitekey=\"__RECAPTCHASITEKEY__\" data-theme=\"__RECAPTCHATHEME__\"></div>```\r\n\r\nCode in: https://github.com/joomla/joomla-cms/blob/staging/plugins/captcha/recaptcha/recaptcha.php (functions onInit and onDisplay)\r\n\r\nSee also https://developers.google.com/recaptcha/docs/display#config\r\n\r\n## System information (as much as possible)\r\n\r\nJoomla 3.4.5"}}