Thursday, 7 May 2015

Defer parsing of JavaScript in Magento

Copy /app/code/core/Mage/Page/Block/Html/Head.php
to
/app/code/local/Mage/Page/Block/Html/Head.php
Go to line 204 and add an defer in line 205
// static and skin javascripts

 $html .= $this->_prepareStaticAndSkinElements('<script type="text/javascript" defer src="%s"%s></script>' . "\n",
            empty($items['js']) ? array() : $items['js'],
            empty($items['skin_js']) ? array() : $items['skin_js'],
            $shouldMergeJs ? array(Mage::getDesign(), 'getMergedJsUrl') : null
        );

8 comments:

  1. I will free download magento as soon as possible. Magento is truly the best platform ever.

    ReplyDelete
  2. Hi Author

    Thank you for your solution. It did not worked for me,
    May be you can try solution given at Magento Coders

    Visit Us : Magento Ecommerce Development Company in India | Parsys Media

    ReplyDelete
  3. I used your guide with my new extension Magento banner slider extension, hope that it will work

    ReplyDelete
  4. I am very grateful to read your blog.I hope you would provide the great services in the field of website design and development and Search Engine Optimization. Thank for the share..
    Website Development Company Bangalore

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete

Note: only a member of this blog may post a comment.