recaptcha
recaptcha copied to clipboard
[Lighthouse] Does not use passive listeners to improve scrolling performance
How can I solve this issue?
G-Recaptcha causes some things about performance also. Before integrating G-Recaptcha, score is 56, after is 46 :(
I'm not a JS expert, but this could do the work (v3):
function initRecaptcha(){
var recaptchaScript = document.createElement('script');
recaptchaScript.type = 'text/javascript';
recaptchaScript.src = 'https://www.google.com/recaptcha/api.js?render=' + YOUR_SITE_KEY + '&ver=3.0';
recaptchaScript.id = 'google-recaptcha-js';
document.body.appendChild(recaptchaScript);
}
window.addEventListener('scroll', function (){
initRecaptcha();
}, {once:true});
And there should be similar event if someone click/focus input before initRecaptcha. And event that refresh token every 2min.