How to Defer Parsing Of Javascript In Magento (Magento1)

How to Defer Parsing Of Javascript In Magento

One of the most important things for a website to do, especially an e-commerce website, is to load quickly.  Most shoppers will not wait more than 4 seconds for your page to load and if they have to wait, they most likely will leave and go on to the next store.  Statistics show that a half-second delay can result in as much as 20% less traffic to your site. And if your site continues to be slow most users will simply get frustrated after viewing a few products/pages and move on to a competitors site.   These large loading pages are also less likely to rank well on google. 

So we run into the question of how to speed up page load with Magento websites with can often be bulky.  There are many things that can be done, from minifying css/js, to compressing/optimizing images, by using a CDN network to load your Javascript, to reducing the number of HTTP requests on a single page. However the method we are going to talk about today is how to defer parsing of Javascript in Magento.


So what are some of the best ways to defer parsing of Javascript in Magento?  First, deferring parsing of Javascript means that you will be waiting until the entire page is loaded before even starting to parse the JS and load it in.  Of course there will be Javascript that you need to load when the page first loads.  That Javascript should be put in the header and loaded as needed, but any Javascript that can be saved to load until later should definitely be put in the footer section and tried to be deferred.

One way to defer the parsing of Javascript in Magento is to create a function that will call your external javascript functions after page load.  This will allow you to time the javascript that loads the file at the end of the page, at which time it will load in the external file long after the page is loaded.  Again do not do this with any Javascript that you need for the look and feel of the site or for the website to load properly.

Another way to defer parsing of Javascript in Magento is to use an extension.  There are several modules which can assist with this action, but be aware that even with a module to defer javascript, there may still be some manual modifications by a developer in order to get working correctly.

If you aren’t exactly sure how to defer parsing of javascript in Magento, please call the experts at CyberSolutions LLC for expert care and advice with your e-commerce store.


case studies

See More Case Studies

Contact us

Partner with Us

We’re happy to answer any questions you may have and help you determine which of our services best fit your needs.

Your benefits:
What happens next?

We Schedule a call at your convenience 


We do a discovery and consulting meeting 


We prepare a proposal 

Schedule a Free Consultation
Simplifying IT
for a complex world.
Platform partnerships