But if you change the path above by something starting with http or https, Magento will not recognize it as being external and try to append the base js url to it. For example a line like this:
will outpout something like that in the header:
You can of course hard code the script tag but 1) it will have to be before or after the files included by the xml, which might create some conflicts and 2) it’s not fun at all!
My idea of a solution
After digging into some of the core files responsible for the output of the js I started to have a better idea of how to resolve the issue. The good thing about Magento is that when a core file does not behave the way you want, you can “easily” override.
The file we want to change here is Mage/Page/Block/Html/Head.php. This is where Magento handles inclusions in the header as well as file merging for js and css, among other stuff.
I am going to override this class to change one of its function: &_prepareStaticAndSkinElements(). Here is the new code:
Very simple, if the path has http:// or https:// then do not include the baseurl
You then need to declare the new class in etc/local.xml. Add those lines between the existing <global> tags:
<blocks> <page> <rewrite> <html_head>Foo_Page_Block_Html_Head</html_head> </rewrite> </page> </blocks>