I'm trying to optimize my Magento 1.9.3 website, following Google PageSpeed hints, saying I have js and css that load synchrounously and block the page rendering.
To solve this issue, I'm putting all the javascript files with async loading, as advised in this answer.
So all my loaded scripts looks like this:
<action method="addItem"><type>skin_js</type><name>js/jquery.fancybox.2.1.5.min.js</name><params>defer</params></action>
<action method="addItem"><type>skin_js</type><name>js/jquery.fancybox.2.1.5.min.js</name><params>async</params></action>
This way, running PageSpeed again, gives better results.
The problem is that I get plenty of javascript exceptions, because probably the scripts that are inside templates files (.phtml), load before the script has been loaded. This is worse, if I clear the browser cache and reload the page.
So, is there a better way to solve this "problem"? Should I move all the files at the end of the page? Or just ignore GooglePageSpeed hints?
Thank you in advance.