• Hello,

    Can you guys move this piece of code from line 14 – 39 to line 464 – 488?

    $( function() {
    		wpcf7.supportHtml5 = ( function() {
    			var features = {};
    			var input = document.createElement( 'input' );
    
    			features.placeholder = 'placeholder' in input;
    
    			var inputTypes = [ 'email', 'url', 'tel', 'number', 'range', 'date' ];
    
    			$.each( inputTypes, function( index, value ) {
    				input.setAttribute( 'type', value );
    				features[ value ] = input.type !== 'text';
    			} );
    
    			return features;
    		} )();
    
    		$( 'div.wpcf7 > form' ).each( function() {
    			var $form = $( this );
    			wpcf7.initForm( $form );
    
    			if ( wpcf7.cached ) {
    				wpcf7.refill( $form );
    			}
    		} );
    	} );
    

    This would make your script deferrable and give your user some points on google’s pagespeed insights.
    This is a deal breaker for some clients sadly, so I did the changes but they will be overwritten on the update.
    Please let me know if there is an easier way to defer your script without triggering the error.

    P.S. I also advise wrapping the $(‘div.wpcf7… part in $(document).ready(…

    Thank you for your attention!

  • The topic ‘Make script.js deferrable’ is closed to new replies.