seo seems to load twice with cssrelpreload
u007 opened this issue · 7 comments
ive tested a site on:
https://developers.google.com/speed/pagespeed/insights
and it seems to show css being loaded twice
https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fnurture.ai
but works great on browser
@u007 I'm checking and you are right. On the browser and webpagetest the CSS is only requested once.
I'm not sure if this issue should be kept open, as it seems to be something on pagespeed's side.
nice :),
thanks for checking it out, yes i suspect its google pagespeed issue.
i feel the site is fast enough, but somehow it still complaints on pagespeed
It also happens with https://fonts.googleapis.com/css?family=Open+Sans:300,400,600
. It actually shows it 3 times.
I tried with the demo page but it doesn't show that section, probably because it needs to request more CSS resources to show up.
@rasenplanscher It doesn't happen anymore. However, I just browses the initial payload for nurture.ai and can't see the loadCSS
function anymore.
I know https://www.smashingmagazine.com/ uses a similar function and PageSpeed Insights doesn't report render-blocking issues on that site.
@JMPerez
Thank you for checking again 😄
It doesn't happen anymore. However, I just browses the initial payload for nurture.ai and can't see the
loadCSS
function anymore.
They have it in their application.[hash].js
.
I know https://www.smashingmagazine.com/ uses a similar function and PageSpeed Insights doesn't report render-blocking issues on that site.
They use this package, this is copied verbatim from their homepage:
<script>
(function(w){"use strict";var loadCSS=function(href,before,media){var doc=w.document;var ss=doc.createElement("link");var newMedia=media||"all";var ref;if(before){ref=before}else{var refs=(doc.body||doc.getElementsByTagName("head")[0]).childNodes;ref=refs[refs.length-1]}var sheets=doc.styleSheets;ss.rel="stylesheet";ss.href=href;ss.media="only x";function ready(cb){if(doc.body){return cb()}setTimeout(function(){ready(cb)})}ready(function(){ref.parentNode.insertBefore(ss,before?ref:ref.nextSibling)});var onloadcssdefined=function(cb){var resolvedHref=ss.href;var i=sheets.length;while(i--){if(sheets[i].href===resolvedHref){return cb()}}setTimeout(function(){onloadcssdefined(cb)})};if(ss.addEventListener){ss.addEventListener("load",function(){this.media=newMedia})}ss.onloadcssdefined=onloadcssdefined;onloadcssdefined(function(){if(ss.media!==newMedia){ss.media=newMedia}});return ss};if(typeof exports!=="undefined"){exports.loadCSS=loadCSS}else{w.loadCSS=loadCSS}})(typeof global!=="undefined"?global:this);
loadCSS('/css/main.css');
</script>
@u007 @scottjehl
Please close this issue, it seems to be resolved.