• Good day Folks,

    We are trying to optimize the load speed on our website. It seems that deferring parsing of javascript is keeping us to load our site faster.

    We added this code with no success:

    function defer_parsing_of_js ( $url ) {
    if ( FALSE === strpos( $url, ‘.js’ ) ) return $url;
    if ( strpos( $url, ‘jquery.js’ ) ) return $url;
    return “$url’ defer “;
    }
    add_filter( ‘clean_url’, ‘defer_parsing_of_js’, 11, 1 );

    Is there a specific configuration in the plugin that we need to follow to help us out with this?

    We really don’t care about the scoring, but we do have a need for speed.

    In advance, thank you for your help and interest.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, the local JS is aggregated and deferred when you have “optimize JS”, “aggregate JS” active and don’t “force JS into head”. at that point you’ll only have jquery and 3rd party JS to worry about. for jQuery you can try removing that from the JS optimization exclusion list, for 3rd party JS you can try adding that to Settings -> Autoptimize -> Extra -> Async or you can use the “Async Javascript” plugin.

    hope this helps,
    frank

    Thread Starter Copiaurbietorbi

    (@copiaurbietorbi)

    That’s how we have your plugin configured among other settings. How do we know what jquery to add on the optimization list?

    We are getting this in the score:

    https://www.site.com/wordpress/wp-includes/js/jquery/jquery.js (86.8KiB)
    https://www.site.com/ (411B of inline JavaScript)

    Thank you for your help.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, you could indeed try removing js/jquery/jquery.js from the JS optimization exclusion list and then test if your site works OK like that?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Defer Parsing of javascript’ is closed to new replies.