All js script are loaded in footer in magento 1.9. I want them in head. Can Anyone let how to do this ?

2 Answers 2


Who told you that the JS files are loaded in footer ? the JS files are declared and loaded from and in head.

Here is the native way how to include a JS file:

<?xml version="1.0"?>
<layout version="0.1.0">
        <reference name="head">
            <action method="addItem"><type>skin_js</type><name>js/script_name.js</name></action>
  • In default its in head. but there is an script or something that pull the js in footer Mar 9, 2018 at 13:14
  • So if I decide to remove the footer from my website, there will be no JS that will be loaded ?
    – PЯINCƎ
    Mar 9, 2018 at 13:17
  • Do you use an extension for page-speed? We have an extension from amasty, that provides the function to move the javascript to the footer. Its not the default behavior of magento1 (but it can be positive regarding page-speed)
    – Mario
    Feb 18, 2022 at 11:40

To add js in the head you can edit layout xml files where you want your scripts in the head.

Example in \app\design\frontend[your-theme]\default\layout\page.xml:

<layout version="0.1.0">
    <default translate="label" module="page">
        <block type="page/html" name="root" output="toHtml" template="page/2columns-left.phtml">
            <block type="page/html_head" name="head" as="head">
                <action method="addJs"><script>script.js</script></action>
                <action method="addItem"><type>js</type><name>script2.js</name></action>
                <action method="addItem"><type>skin_js</type><name>script3.js</name></action>

This are just some examples. Hope this helps.

Edit: I think you have a modified version of Magento 1.9 because in the default version all js are in the head.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.