Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Place Javascript Just Under the Opening Body Tag
 
janellez
Jr. Member
 
Total Posts:  15
Joined:  2010-03-08
 

This seems like a simple question but it’s turning out not to be.  Our tag management provider would like us to put their javascript snippet “just under the opening body tag”.  They don’t want it in the footer and they don’t want it in the header (the two places I can reasonably put it myself from within the admin/configuration panel).

We are using the Magento Enterprise template and when I look at design/frontend/enterprise/template/page/html, I see footer.phtml and header.phtml and rss.phtml.

Am I looking in the wrong place?  Can anyone help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

Magento has two predefined insertion blocks for this. after_body_start and before_body_end are their names and the referenced post link describes how to add the block and then reference it in the layout so it gets called at the proper time. Use after_body_start

The advantage of using the layout method is that you can have strict control and keep the javascript out of the cart where it may conflict severely with operations and prevent cart function.

http://www.magentocommerce.com/boards/v/viewreply/384445/

 
Magento Community Magento Community
Magento Community
Magento Community
 
janellez
Jr. Member
 
Total Posts:  15
Joined:  2010-03-08
 

Thank you - I appreciate your answer!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top