Add js in head in magento 1.9
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
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.
add a comment |
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
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.
add a comment |
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
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
magento-1.9 javascript xml
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.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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>
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
add a comment |
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.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Mar 9 '18 at 13:14
Adrian Z.Adrian Z.
584110
584110
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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