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

    Default Trying to figure out fix for: 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
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Trying to figure out fix for: Defer parsing of JavaScript

    Note: java is not the same as javascript. Try asking your question on a javascript forum.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. if and else if being ignored can't figure out why....
    By lornapowell13 in forum New To Java
    Replies: 2
    Last Post: 10-17-2013, 11:40 PM
  2. Help! Cant figure it out
    By Anthony5347 in forum New To Java
    Replies: 1
    Last Post: 09-12-2013, 09:13 AM
  3. can someone help me to figure this out >.<
    By kissmeeq in forum New To Java
    Replies: 2
    Last Post: 08-01-2011, 03:19 PM
  4. Need help - I can't figure it out.
    By Joshsmith in forum New To Java
    Replies: 2
    Last Post: 10-23-2009, 10:12 PM

Posting Permissions

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