1. This website uses cookies to improve service and provide a tailored user experience. By using this site, you agree to this use. See our Cookie Policy.
    Dismiss Notice

How do I fix this "Defer Parsing of JavaScript" issue showing in my GTMetrix test?

Discussion in 'HTML & JavaScript' started by bikkiboss, Jan 21, 2019.

  1. bikkiboss

    bikkiboss Junior Member

    Joined:
    Jan 21, 2017
    Messages:
    153
    Likes Received:
    33
    Gender:
    Male
    [​IMG]

    [​IMG]
    I ran a speed test on GTMetrix for my website , everything seem to be alright except this "Defer Parsing of Javascript" issue, can someone please instruct how can I fix this?
    I have attached the error screenshot above
    Thanks
     
  2. DeathClaw665

    DeathClaw665 Newbie

    Joined:
    Jan 9, 2018
    Messages:
    13
    Likes Received:
    4
    Gender:
    Male
    Home Page:
    You should load scripts by addind "async" or "defer" code. example:


    <script type="text/javascript" defer src=""></script>

    or

    <script type="text/javascript" async src=""></script>

    Remember: not all scripts can be run like that.
     
  3. emure

    emure Newbie

    Joined:
    Aug 10, 2018
    Messages:
    41
    Likes Received:
    29
    Gender:
    Male
    Occupation:
    Webdeveloper
    Location:
    Lithuania
    Totally agree, but I would add both of these attributes.

    But as @DeathClaw665 mentioned, not all scripts can be run like that.

    Sometimes (actually most of the time) you need manually change code or combine javascript files into one. There are a lot of techniques and it depends on particular situation.
     
  4. SoccerLover

    SoccerLover Moderator-In-Training Jr. VIP

    Joined:
    Jun 12, 2014
    Messages:
    4,752
    Likes Received:
    2,406
    Gender:
    Male
    Occupation:
    Managing BHW :D
    Location:
    ♥♥♥ BHW ♥♥♥
    Home Page:

    THREAD MOVED