-
AuthorPosts
-
April 27, 2016 at 12:18 am #622588
Hi,
How can I improve pagespeed insight, and move style.css file to footer (tried to use scripts to footer, but it dont help) or import code from it to index?
Like this code:<script> if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } xhr.open("GET",'/stl/style.css',false); xhr.send(); var lazyStyle = document.createElement('style'); lazyStyle.innerHTML = xhr.responseText; document.head.appendChild(lazyStyle); </script>
- This topic was modified 8 years, 7 months ago by mdxclr.
April 29, 2016 at 2:12 pm #624456Hey mdxclr,
loading css in the footer is nothing that is not a valid way to load styles according to the W3C so there is really no easy way to do this. And even if you do so it might not really help your site and just satisfy a general guideline.
Just read the second response from Thomas here: https://groups.google.com/forum/#!topic/pagespeed-insights-discuss/uzOYa_lrepw
And in fact, this is not a real issue. Your pages may load fast as lightning without this rule fulfilled or slowly like snails fulfilling it. Remember the hints at Page Speed Insights are just hints and suggestions what you could do to improve your users’ experience. PSI does not measure the real loading times over different connections and with different devices (we all know some of them are a pain – both), but only technical preconditions.
In short: I wouldnt worry about the rule and not waste to much time trying to satisfy it…
Best regards,
KriesiApril 29, 2016 at 2:15 pm #624466Hey!
We do not recommend moving styles to the bottom doing so will cause a flash of unstyled elements. The styles are anyways minified and it should load fast.
However to improve the page speed you can move some js files to the footer using a wordpress plugin like https://wordpress.org/plugins/scripts-to-footerphp/
Cheers!
Vinay- This reply was modified 8 years, 6 months ago by Vinay.
April 29, 2016 at 3:26 pm #624564Used autoptimize and scripts to footer and get 95%.
Thank you. -
AuthorPosts
- The topic ‘Load CSS in footer’ is closed to new replies.