top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to add all existing js files which we see after page source of home page, before end of the body tag in magento ?

+3 votes
83 views
How to add all existing js files which we see after page source of home page, before end of the body tag in magento ?
posted Sep 23, 2015 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

Put the JS file somewhere into the "js" folder, and in the XML layout you can include it with:

<reference name="head">
    <action method="addJs"><script>folder/file.js</script></action>
</reference>

Edit: You can also do it in your block:

protected function _prepareLayout()
{
    $this->getLayout()->getBlock('head')->addJs('path/from/js/folder/to/your/file.js');

    return parent::_prepareLayout();
}
answer Oct 21, 2015 by Devyani
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...