Render blocking css issue with WP 4.5? JQuery issue?
-
Hi Frank,
I am a happy user of your great plugin. There is is a weird behavior of the AO not seen before on my site.
It worked all fine even one week ago but I don’t know if after the WP4.5 upgrade something’s changed. Inline and Defer CSS checked as usual but I get render blocking css in Google PageSpeed Insights and results now are 79/98 and before 95/95. Viewing the source I see the autoptimize_xxxx.css in <noscript> in head that is fine in case of disabled JS. Is that correct?
<noscript><link type="text/css" media="all" href="https://www.domain.com/wp-content/cache/autoptimize/css/autoptimize_d1fe34ed4cf56e23b3db89d99287216b.css" rel="stylesheet" /><link type="text/css" media="screen" href="https://www.domain.com/wp-content/cache/autoptimize/css/autoptimize_edcb76d99f17ef5a13dd8f7bed29d0df.css" rel="stylesheet" /></noscript>
But there is something more and I do not understand if I use pingdom tools or gtmetrix I see first loaded autoptimize_xxxx.js and after this autoptimize_xxxx.css and that means no render blocking css?
What is wrong?
I feel Jquery makes mess and maybe the issue with JS in WP45 because I get 2 errors “Uncaught ReferenceError: jQuery is not defined”. I have seen your post about it.
My thoughts:
Let’s assume I do not want JQuery in head.
Also aggregate inline JS? unchecked
Force JavaScript in <head>? uncheckedOn the bottom in source code we have JS./JQ scripts now.
But I see some JS/JQ scripts above the AO block of code and that could be one of the issues. The scripts order matters too.So that looks like this
</footer> <script> some jS/JQuery scripts </sript> ... deffer AO block: <script type="text/javascript" defer src="https://www.domain.com/wp-content/cache/autoptimize/js/autoptimize_848629b5eb52600e9cdbcac697a50961.js"></script><script data-cfasync='false'>function lCss(url,media) {var d=document;var l=d.createElement('link');l.rel='stylesheet';l.type='text/css';l.href=url;l.media=media;aoin=d.getElementsByTagName('noscript')[0];aoin.parentNode.insertBefore(l,aoin.nextSibling);}function deferredCSS() {lCss('https://www.domain.com/wp-content/cache/autoptimize/css/autoptimize_d1fe34ed4cf56e23b3db89d99287216b.css','all');lCss('https://www.domain.com/wp-content/cache/autoptimize/css/autoptimize_edcb76d99f17ef5a13dd8f7bed29d0df.css','screen');}if(window.addEventListener){window.addEventListener('DOMContentLoaded',deferredCSS,false);}else{window.onload = deferredCSS;}</script>
I think it should be the order like this:
</footer> <script> .... deffer AO Scripts (JQuery inside) </script> <script> other scripts, because they first need Jquery (agrregated in AO_xxx.js) some jS/JQuery scripts </script>
- The topic ‘Render blocking css issue with WP 4.5? JQuery issue?’ is closed to new replies.