1

Google insights is showing eliminate render bloking javascripts and css in above the fold content, i have used all way of doing this but haven't got the right solutions. my magento version is 1.9, please help me in which file should i make changes to get the thigns done and improve my pages speed

http://example.com/media/js/59f4eef32de9bea01d990b46e1d46611.js http://example.com/skin/frontend/default/sm_lovefashion/js/jquery-1.7.2.min.js

2

Render blocking javascript will be any <script> tags that are in the <head> or <body> of the page before/during your page content, these will be located across multiple template files in Magento. What Google wants is for you to move these to the bottom of the page to defer javascript execution until the entire page has been rendered.

Another possible way to action this is to add the async="true" attribute to every <script> tag. The drawback here will mean you will have to update every single template file that has a script tag. Which is far from ideal.

The task of moving all javascript added to either the <head> or throughout the <body> is not very straightforward to achieve in Magento 1.x, as some of the javascript will contain data from blocks.

However, Tom Robertshaw created this module which does exactly that: https://github.com/bobbyshaw/magento-footer-js

The way this works is by running a set of a regular expressions against the result and moves all <script> tags to the end of the document. There is additional configuration to exclude javascript from being moved.

In summary:

  • Javascript should be added to the footer of the page so that rendering can be completed without javascript being executed (and there for blocking rendering).
  • Use async="true" where possible.
  • Try out Tom Robertshaw's module to move all js to the footer: https://github.com/bobbyshaw/magento-footer-js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.