• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Defer JS

Defer JS 2.2.4

No permission to download
Moves XenForo javascripts to before the </body> tag for performance.
Compatible XF 1.x 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.
Author
Jeremy P
Downloads
878
First release
Last update
Rating
5.00 star(s) 19 ratings

More resources from Jeremy P

Latest updates

  1. Fix for loading attachments into memory

    This fixes a bug where attachments were loaded into memory to check for HTML content. This could...
  2. Fix HTML attachment conflicts

    This release fixes an issue where HTML attachments would have their scripts deferred by the...
  3. Add missing XML file

    Added back the XML file.. there was a bug in my XenForo build scripts ;) Thanks @Carla Birch!

Latest reviews

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!
Jeremy P
Jeremy P
Thanks for the review! I'm glad the add-on is useful :)
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!
Jeremy P
Jeremy P
You're very welcome. Thank you for the review!
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.
Jeremy P
Jeremy P
Thanks!
Wow, this is fantastic, especially when using Audentio styles. Thank you so much for this! Keep up the good work :)
Jeremy P
Jeremy P
Thanks for the review!
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
Jeremy P
Jeremy P
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.
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!
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.
Jeremy P
Jeremy P
Thanks! Glad it was useful :)
Works as described, nice optimisation.
Jeremy P
Jeremy P
Thank you.
Awesome.
Jeremy P
Jeremy P
Thanks!
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.
Jeremy P
Jeremy P
I agree, though deferring CSS (by Google's standard) isn't all that easy to accomplish