Support » Plugin: Autoptimize » Autoptimize Google Console Error – defer.js

  • Resolved brg2410

    (@brg2410)


    Hello,

    I am in the process of setting up Autoptimize and getting an “error” in google console;

    autoptimize_5086195f158f7ccad90aaf85427153bf.js:176 GET https://alpensigns.co.uk/defer.js net::ERR_ABORTED 404

    Would you be so kind to look into this and offer any guidance on how we can resolve this?

    Everything appears to be working fine so, it’s just the web-dev side is trying to keep all running error-free.

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Likely due to the Autoptimize cache having been cleared brg2410 so the file is simply not there any more. Nothing much you can do except for ensuring 404’s are handled by WordPress (not the case on WP Engine by default) and activating the “404 fallback” (if not active yet).

    Thread Starter brg2410

    (@brg2410)

    Hello,

    Thanks for the quick response. In response to your suggestions:

    1 – We do have “Redirect 404” set up to deal with general WordPress 404s
    2 – I have activated “404 fallback” on AO as suggested.

    Just tested again and there is a level of cache buildup now (ie. I have not just cleared the cache), but still getting the error message: /defer.js:1 Failed to load resource: the server responded with a status of 404 ().

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah, but /defer.js is not related to Autopitmize I’m afraid, no idea where/ what that is from … :-/

    Thread Starter brg2410

    (@brg2410)

    Hello.

    I have checked various things this side, and the 404 is due to a missing file. This is the file it is requesting: wp-content/cache/autoptimize/js/autoptimize_5086195f158f7ccad90aaf85427153bf.js, relating to autoptimize and as this isn’t present in that directory on our site, so it’s showing a 404.

    Our web developer has suggested the only way to resolve this is by speaking to you, as there is nothing we can do this side to fix it, as it’s relating to a file within your plugin.

    Any ideas?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, for the autoptimize file my comments above apply, but the file you mention is available, I don’t get a 404;

    Thread Starter brg2410

    (@brg2410)

    Understood, and so within the file “http://alpensigns.co.uk/wp-content/cache/autoptimize/js/autoptimize_5086195f158f7ccad90aaf85427153bf.js” – at the very bottom (4th function from bottom) is the rogue script in question:

    function downloadJSAtOnload(){var element=document.createElement(“script”);element.src=”defer.js”;document.body.appendChild(element);}

    Does this help isolate things your side?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah, well, the original JS seems to be inline (so you have “also aggregate inline JS” on), maybe add downloadJSAtOnload to the comma-separated JS optimization exclusion list to keep it from being aggregated?

    Thread Starter brg2410

    (@brg2410)

    Hello.

    Looking at page load index on google console again, there are two functions listed below: The top one is clearly incorrectly referring to a “defer.js” and the bottom one is referring to your plugin and works correctly. Are these functions added by your plug-in and any idea where they might be located?

    });</script> <script type="text/javascript">function downloadJSAtOnload() {
    var element = document.createElement("script");
    element.src = "defer.js";
    document.body.appendChild(element);
    }
    if (window.addEventListener)
    window.addEventListener("load", downloadJSAtOnload, false);
    else if (window.attachEvent)
    window.attachEvent("onload", downloadJSAtOnload);
    else window.onload = downloadJSAtOnload;</script> </div> <script defer src="https://2g4dljvaggm2xhszo250wg3h-wpengine.netdna-ssl.com/wp-content/cache/autoptimize/js/autoptimize_a4d5dfebcf1a822da3c17cd5a2719a14.js"></script></body></html>
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    no, that JS is not by/ from Autoptimize, it is added inline (so directly in the HTML, not from a sourced JS-file) by another plugin (or theme, but that would surprise me).

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    were you able to pinpoint the plugin that adds that JS brg2410 ?

    Thread Starter brg2410

    (@brg2410)

    Hi. It ended up being an AVADA issue, and all is now resolved. Thanks for your input on this.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, feel free to leave a review of the plugin and support here! šŸ™‚

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.