Add an External JS in Magento

To Add an External JS without any problem use this in XML Layout:

[box type=”info”]<reference name="head"><block type="core/text" name="google.cdn.jquery">
<action method="setText"><text><![CDATA[<script type="text/javascript" src=""></script><script type="text/javascript">jQuery.noConflict();</script>]]></text></action></block></reference>

The External JS will be added to the <head> tag.

You Might Also Like

  • james rayan

    Hello Gaurav,
    I have a question regarding why javascript file added in header section as per i know javascript file should be added in the footer section so that it perform well, i know magneto follow the fall back modeal too.but i still i can’t understant why ?please give me some satisfactery answer…

    • Mindgeek

      You’re right if Javascript is included on footer of the webpage it will be executed after the page is rendered, which doesn’t block the webpage rendering.

      If you want to add this Javascript in Footer, use the following code: