Adding external JavaScript file to Magento

Magento Kid picture Magento Kid · Jan 11, 2011 · Viewed 75.8k times · Source

How to add external JavaScript file to Magento, so it's code would be included on every frontend page?

Answer

Gaurav Tewari picture Gaurav Tewari · Jul 26, 2012

To add an external JS without any problem use this:

<reference name="head">
   <block type="core/text" name="google.cdn.jquery">
      <action method="setText">
        <text>
           <![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><script type="text/javascript">jQuery.noConflict();</script>]]>
        </text>
      </action>
   </block>
</reference>