Support » Fixing WordPress » Should I put all javascript links in the footer?

  • Resolved neilmac


    I hear – eg from Google analytics – that you should put your javascript links above the closing body tag to speed up your site but most WP sites I visit have them in the head.
    Is there any reason why I should not move my js links into my footer?
    Is this better practice?
    Any red flags?

Viewing 2 replies - 1 through 2 (of 2 total)
  • if the js doesn’t make a difference to the way the page should look when first loaded, then footer is fine – it defers the loading of the code until the page is rendered on most browsers.

    JS linking in the HEAD has to be downloaded before a page starts to render on most browsers, so it slows down the site’s apparent responsiveness


    Thanks very much Alan.
    I have now decided I don’t need that particular bit of javascript in any other pages apart from the home.php
    So rather than place it right in the footer I have moved it to the bottom of home.php
    That’s not ideal for the home page – though it’s better – but it does mean the other pages load much faster as they don’t even call the js from the footer.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Should I put all javascript links in the footer?’ is closed to new replies.