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

XF 1.5 Help Please

Discussion in 'Troubleshooting and Problems' started by Brad P, Jul 4, 2016.

  1. Brad P

    Brad P Active Member

    why does async, when put on "page_container_js_head" template, to make jquery load along side with everything else, breaks other
    parts of xenforo. Like addons, posting threads, or sending private messages.
    Samet Chan likes this.
  2. Jeremy P

    Jeremy P Well-Known Member

    JavaScript in XenForo has a hard dependency on jQuery. If scripts are loaded with async/defer then jQuery might not be available when execution starts. This is the primary reason I'm still using the old method of deferring scripts in my add-on (placing them before the </body> tag). Additionally, async will make execution start immediately, before the page is finished loading, which is probably incompatible with most XenForo JavaScript.

    I haven't played around with it too much, but I'm not sure there's a reliable way to use <script defer> without breaking dependencies. Callbacks might be an option, I suppose.
    Last edited: Jul 4, 2016
    suasive likes this.

Share This Page