Magento – Uncaught ReferenceError: Mage is not defined

magento-1.9

We are now developed a Magento store. When I open the index page and then go to the menu of Chrome and then display dev tools of chrome, I have an error Uncaught ReferenceError: Mage is not defined index:39 and the index is variable according to the page displayed with the links of the website.
Anyone can help me with that matter?
Website index page

Best Answer

js/mage/cookies.js

is not loading. It defines the Mage Javascript class.

See this line:

if (!window.Mage) var Mage = {};

Custom theme issues most likely. Check for a page.xml file in your custom theme and see if it's missing the include for that file. The line will look like this: <action method="addJs"><script>mage/cookies.js</script></action> People tend to override that file directly instead of making local.xml layout edits and it tends to cause problems like this. You could test temporarily turning off your theme and seeing if the issue persists.

Related Topic