By default it's impossible to load external javascript files in the head of the Magento admin environment.

It is possible to rewrite the admin head.php block in order to load external js, but this might cause incompatibility issues with other extensions.

Alternatively you can load an external JS file with pure javascript as follows:

 

First include a 'wrapping' javascript file in the head using layout.xml like so:


<reference name="head">
 <action method="addJs">
  <name>mymodule/loadexternaljs.js</name>
 </action>
</reference>

 

Then add the following content to your .js file:


document.write("<script src='http://www.example.com/js/externalfile.js'><\/script>");

 

This can come in handy to for example load the Google Maps API, which requires you to load external files!

Leave a Reply