1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Defer JS 2.2.4

Moves XenForo javascripts to before the </body> tag for performance.

  1. Jeremy P
    Compatible XF Versions:
    • 1.4
    • 1.5
    Additional Requirements:
    PHP 5.4+
    License:
    MIT
    Visible Branding:
    No
    This add-on moves javascripts in page output to the bottom of the page. This has a noticeable impact on page-load times as pending HTTP requests postpone rendering of a page, while scripts aren't run until everything is loaded anyways.

    There is a blacklist available in the options for scripts that don't play nicely with this add-on.


    screenshot-kW1Ydw.png

    This add-on requires PHP 5.4+!
    Trying to install it on earlier versions will break your forum.


    Much of the heavy lifting was derived (with permission) from @Luke F's XFOptimise add-on, which is no longer maintained.
    LanceBase, maszd, Robru and 14 others like this.

Recent Reviews

  1. Axel B
    Axel B
    5/5,
    Version: 2.2.3
    Brilliant addon. As many people before me have stated, this should be in the core functionality of Xenforo. Fortunately Jeremy P created it and shared it with te public. Keep up the good work! Highly appreciated!
    1. Jeremy P
      Author's Response
      Thanks for the review! I'm glad the add-on is useful :)
  2. rillivilli
    rillivilli
    5/5,
    Version: 2.2.3
    Fantastic add-on!
    This should really be in XF by default. Frankly its a bit mind blowing how much js is in xenforo and additional styles. Deferring and gzipping are a must.

    Thank you Jeremy P!
    1. Jeremy P
      Author's Response
      You're very welcome. Thank you for the review!
  3. BobbyWibowo
    BobbyWibowo
    5/5,
    Version: 2.2.3
    Recommended add-on if you care about your website's performance, and if you care about those PageSpeed and/or YSlow scores as well. I'm using this with an UI.X-based style, and I gotta admit that result is satisfying.
    1. Jeremy P
  4. TRGCommunity
    TRGCommunity
    5/5,
    Version: 2.2.3
    Wow, this is fantastic, especially when using Audentio styles. Thank you so much for this! Keep up the good work :)
    1. Jeremy P
      Author's Response
      Thanks for the review!
  5. 1461748123
    1461748123
    5/5,
    Version: 2.2.3
    Using with UI.X really helps the loading speed. I hope there will be a option to allow user to switch it on/off, since some of my user said that js load really slow and they are not able to use any js base function until the page was fully loaded.

    4.9/5 :D
    1. Jeremy P
      Author's Response
      You're right that JS functionality won't work until the page is fully loaded, but without the add-on the page just doesn't render at all until everything is loaded. The time-to-JS-functionality is the same in either case, but with the add-on, the page content is displayed while the scripts are loading.

      XF JS doesn't execute until the DOM is ready anyways.

      If people are still interested in this functionality though, I would consider it.
  6. DistortedDorian
    DistortedDorian
    5/5,
    Version: 2.2.3
    Improves the loadspeed when using a custom theme from Audentio, the page blinks when switching from one page to another however it's slightly better with this resource!
  7. eberkund
    eberkund
    5/5,
    Version: 2.2.0
    Great stuff, does as described. This should be stock!! It improved my Google PageSpeed score a little bit. Not sure why XenForo requires 200 characters now to write reviews but it is very very annoying.
    1. Jeremy P
      Author's Response
      Thanks! Glad it was useful :)
  8. Sidane
    Sidane
    5/5,
    Version: 2.1.0
    Works as described, nice optimisation.
    1. Jeremy P
      Author's Response
      Thank you.
  9. Onemind Creative
    Onemind Creative
    5/5,
    Version: 2.1.0
    Awesome.
    1. Jeremy P
  10. Anthony Parsons
    Anthony Parsons
    5/5,
    Version: 2.1.0
    Like it. Should be default XF IMHO, as such SEO / speed aspects should all be core. Saying that, would be nice to also see the same for fixing some of the CSS defer issues.
    1. Jeremy P
      Author's Response
      I agree, though deferring CSS (by Google's standard) isn't all that easy to accomplish