It depends on your request. For instance, lastly, I had been removed all Prototype scripts from the Homepage
of the Magento store which I didn't face any problem. But as I said, it depends on your theme, extensions etc.
To moving the script :
Find the following line in page.xml
of your theme
<block type="core/text_list" name="before_body_end" as="before_body_end" translate="label">
And insert the following just before :
<block type="page/html_head" name="jsfooter" as="jsfooter" template="page/html/jsfooter.phtml">
<action method="addJs"><script>your_script.js</script></action>
</block>
For Magento 1.9 use this:
<block type="page/html_head" name="jsfooter" as="jsfooter" template="page/html/jsfooter.phtml">
<action method="addItem"><type>skin_js</type><name>js/yourskinfile.js</name><params/></action>
</block>
Create the template file in app/design/frontend/[package]/[theme]/template/page/html/jsfooter.phtml and put the following
<?php echo $this->getCssJsHtml() ?>
Add below in your template just before closing </body>
tag.
<?php echo $this->getChildHtml('jsfooter') ?>
You could try adding a new structural block and echo this out before the tag where you require.
<default>
<reference name="root">
<block type="core/text_list" name="my_before_body" as="my_before_body" translate="label">
<label>My before body</label>
</block>
</reference>
<reference name="my_before_body">
<block type="core/template" name="marketplace_player" template="magenetwork/list.phtml">
</reference>
</default>
You would then need to echo out this new structural block in your page templates before the body tag
<?php echo $this->getChildHtml('my_before_body') ?>
Best Answer
If you want to do it with layout XML instead of the system configuration, for example because you are developing an extension or only need it on certain pages, use the
before_body_end
container. You can put the JavaScript in a template:Or add it as a text block directly in XML: