recaptcha icon indicating copy to clipboard operation
recaptcha copied to clipboard

[Lighthouse] Does not use passive listeners to improve scrolling performance

Open nickcarterney opened this issue 3 years ago • 1 comments

How can I solve this issue? image G-Recaptcha causes some things about performance also. Before integrating G-Recaptcha, score is 56, after is 46 :(

nickcarterney avatar Jul 26 '21 09:07 nickcarterney

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.

Zszywaczyk avatar Sep 26 '21 06:09 Zszywaczyk