In the Magento backend, under System -> Configuration -> Advanced -> Developer -> JavaScript Settings -> Merge JavaScript Files, I set the field value to yes and enabled the Magento merge js. However, by activating this resource, the pages end up having changes in the load and its functionality, since one of the links containing the mined script has the defer parameter, which ends up loading the script after the page is already loaded, script contains other scripts of utmost importance to the functioning of the page.

Example script with defer parameter:

<script type="text/javascript" src="http://url_site/media/js/e921b7a36672e6f60a2f83a84d5f507e.js" defer></script>

I would like to know how to proceed so that you can remove this parameter from the script so that the pages work correctly. Even after researching a lot, I've got a lot of information, but none of them are focused on solving that problem.

  • can you share console log error ??
    – MR.R DNATH
    Jun 18, 2018 at 20:37
  • @MR.RDNATH In the browser console, errors mainly from $j(...) is not a function (on account that I use the variable $j for nonconflict), errors of functions not defined, among others. Jun 18, 2018 at 20:47
  • have you tried this var $j = $.noConflict();
    – MR.R DNATH
    Jun 18, 2018 at 20:56
  • @MR.RDNATH I use this... Jun 18, 2018 at 21:01
  • @MR.RDNATH The problem is that as the script is with the defer parameter, it ends up being loaded afterwards and a good part of jQuery code is executed before executing the related scripts, thus affecting the entire page. Jun 18, 2018 at 21:03

1 Answer 1


Please check

<reference name="head">
    <block type="core/text" name="custom_name">
        <action method="setText"><text><![CDATA[<script type="text/javascript" src="http://url_site/examplea2f83a84d5f507e.js" defer></script>

You can use xml to load external defer link. Let me know if works

  • Did not work... Jun 18, 2018 at 21:16
  • okay, you want to remove "defer" after minified ??
    – MR.R DNATH
    Jun 18, 2018 at 21:18
  • That's right... Jun 18, 2018 at 21:19
  • Magento version 1.9 does not allow to add defer attr after minified. It can be done by the custom implementation or add defer attr into script tag from the host server. Please check hosting server performance tool or can be added through Cloudflare.
    – MR.R DNATH
    Jun 18, 2018 at 21:34
  • The Magento I use has no changes in its base, that is, it is "original" and has not had any kind of custom implementation for this described in the question to occur. On the server, everything is correct, without any intervention in the case. Jun 19, 2018 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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