Magento – Why can’t I add a JS file to Magento

javascriptlayout

I've created a file called page.xml that contains the action method and addJs of the file.

This page.xml file is saved in /app/design/frontend/default/blank/layout and looks like:

<?xml version="1.0"?>
<layout>
  <default>        
    <reference name="head">
      <action method="addJs"><script>custom/progress.js</script></action>
    </reference>
  </default> 
</layout>

I have put the JS file in the main js folder at root under custom/progress.js

When i load the page, no JS file loads up, and I have no idea what file i need to actually edit.

Joomla is so much better at being able to add JS files, why isn't it easy in Magento?

Someone please help me! Also, it's stupid that you can't paste any code here.

Best Answer

Instead of overwriting the page.xml I would suggest using the layout/local.xml file in your active template.

If it doesn't exist please create the file app/design/frontend/default/blank/layout/local.xml and add the page.xml content you've already created.

Please make sure caching and JS script compression are disabled to see the changes