Add js in head in magento 1.9












0















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










share|improve this question
















bumped to the homepage by Community 3 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















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










    share|improve this question
















    bumped to the homepage by Community 3 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








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










      share|improve this question
















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







      magento-1.9 javascript xml






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 9 '18 at 13:14









      PЯINCƏ

      7,76131137




      7,76131137










      asked Mar 9 '18 at 13:02









      pankaj kumarpankaj kumar

      61




      61





      bumped to the homepage by Community 3 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 3 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          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">
          <default>
          <reference name="head">
          <action method="addItem"><type>skin_js</type><name>js/script_name.js</name></action>
          </reference>
          </default>
          </layout>





          share|improve this answer
























          • In default its in head. but there is an script or something that pull the js in footer

            – pankaj kumar
            Mar 9 '18 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 '18 at 13:17



















          0














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



          Example in appdesignfrontend[your-theme]defaultlayoutpage.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>
          </block>
          </block>
          </default>
          </layout>


          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.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f216739%2fadd-js-in-head-in-magento-1-9%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            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">
            <default>
            <reference name="head">
            <action method="addItem"><type>skin_js</type><name>js/script_name.js</name></action>
            </reference>
            </default>
            </layout>





            share|improve this answer
























            • In default its in head. but there is an script or something that pull the js in footer

              – pankaj kumar
              Mar 9 '18 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 '18 at 13:17
















            0














            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">
            <default>
            <reference name="head">
            <action method="addItem"><type>skin_js</type><name>js/script_name.js</name></action>
            </reference>
            </default>
            </layout>





            share|improve this answer
























            • In default its in head. but there is an script or something that pull the js in footer

              – pankaj kumar
              Mar 9 '18 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 '18 at 13:17














            0












            0








            0







            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">
            <default>
            <reference name="head">
            <action method="addItem"><type>skin_js</type><name>js/script_name.js</name></action>
            </reference>
            </default>
            </layout>





            share|improve this answer













            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">
            <default>
            <reference name="head">
            <action method="addItem"><type>skin_js</type><name>js/script_name.js</name></action>
            </reference>
            </default>
            </layout>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 9 '18 at 13:10









            PЯINCƏPЯINCƏ

            7,76131137




            7,76131137













            • In default its in head. but there is an script or something that pull the js in footer

              – pankaj kumar
              Mar 9 '18 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 '18 at 13:17



















            • In default its in head. but there is an script or something that pull the js in footer

              – pankaj kumar
              Mar 9 '18 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 '18 at 13:17

















            In default its in head. but there is an script or something that pull the js in footer

            – pankaj kumar
            Mar 9 '18 at 13:14





            In default its in head. but there is an script or something that pull the js in footer

            – pankaj kumar
            Mar 9 '18 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 '18 at 13:17





            So if I decide to remove the footer from my website, there will be no JS that will be loaded ?

            – PЯINCƏ
            Mar 9 '18 at 13:17













            0














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



            Example in appdesignfrontend[your-theme]defaultlayoutpage.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>
            </block>
            </block>
            </default>
            </layout>


            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.






            share|improve this answer




























              0














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



              Example in appdesignfrontend[your-theme]defaultlayoutpage.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>
              </block>
              </block>
              </default>
              </layout>


              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.






              share|improve this answer


























                0












                0








                0







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



                Example in appdesignfrontend[your-theme]defaultlayoutpage.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>
                </block>
                </block>
                </default>
                </layout>


                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.






                share|improve this answer













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



                Example in appdesignfrontend[your-theme]defaultlayoutpage.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>
                </block>
                </block>
                </default>
                </layout>


                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 9 '18 at 13:14









                Adrian Z.Adrian Z.

                584110




                584110






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f216739%2fadd-js-in-head-in-magento-1-9%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    What other Star Trek series did the main TNG cast show up in?

                    Berlina muro

                    Berlina aerponto