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).
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 ().
ah, but /defer.js
is not related to Autopitmize I’m afraid, no idea where/ what that is from … :-/
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?
well, for the autoptimize file my comments above apply, but the file you mention is available, I don’t get a 404;
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?
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?
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>
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).
were you able to pinpoint the plugin that adds that JS brg2410 ?
Hi. It ended up being an AVADA issue, and all is now resolved. Thanks for your input on this.