magento add javascript tips

Add JS to All Pages
Published on December 23rd, 2010

Magento has various locations for its javascipt files and there are several ways to add them to your page. In order to add js to all your pages use javascript inclusion instruction within <default> handle in your layout file. Here are some examples: The layout below will add js/mydir/myscript.js javascript to all pages. <default> <action method=”addJs”><script>mydir/myscript.js</script></action> </default>