Results 1 to 2 of 2
  1. #1
    westlight is offline Member
    Join Date
    Mar 2016
    Posts
    2
    Rep Power
    0

    Default Wordpress page laod speed: "Defer parsing of JavaScript"???

    I have no clue for the most part about java. I am trying to improve load speeds on my Wordpress photography site. GTMetrix has given me an (F) when it comes to "Defer parsing of JavaScript". The Theme developer made suggestions stating that most of the error messages pertain to plugins but said that making changes to each plugin would get written over during any updates. The other option given was to add the following code into the themes funtions.php file so as to "applies globally to all your plugins". I did this on a test site (test.davidcschultz.com and it helped a bit...but I'm not sure I pasted the code in the right place or correctly. Would like to find out but have been unable to get a follow-up reply from the developer on this. So, here is the code first then at the bottom is where and what I pasted. Thanks for any help or other suggestions!

    <!--?php
    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 );
    ?-->


    >>>>>>>>>>>>
    Here is where and what I pasted at the very bottom of the functions.php file. I've included the last line that was in that file prior to pasting so you could see where it went.

    wp_redirect(admin_url("admin.php?page=functions.ph p&activate=true"));
    }

    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 );
    ?>

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Wordpress page laod speed: "Defer parsing of JavaScript"???

    Once again, Java is not JavaScript. And even if you had a question about Java, please don't double post on the same site. Pick an appropriate category and post there.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Replies: 1
    Last Post: 03-30-2016, 07:30 PM
  2. Replies: 0
    Last Post: 12-07-2012, 08:29 AM
  3. Replies: 1
    Last Post: 07-21-2010, 07:33 AM
  4. Replies: 1
    Last Post: 10-20-2008, 07:35 AM
  5. represent Double as "" instead of 0.0 in .jsp page without javascript
    By Tokajac in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-07-2008, 02:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •