option to have recaptcha js marked as defer/async
-
ContactForm7 including reCaptcha really impacts page load speed on mobile, as the js is huge.
Could we have a defer or async option ? This solves most of the performance issue in page speed / lighthouse, with no impact on captcha feature AFAICT.
Currently solving it with this little hack un functions.js, but having a checkbox (or maybe even having it deferred by default?) would be nice// mark recaptcha js deferred function defer_js( $url ) { if ( is_user_logged_in() ) return $url; if ( strpos( $url, 'recaptcha/api.js' ) ) { return str_replace( ' src', ' defer src', $url ); } return $url; } add_filter( 'script_loader_tag', 'defer_js', 11 );
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.