Web Performance
3 subscribers
6 photos
2 files
17 links
Hints
Download Telegram
Channel created
True defer loading of javascript:

This code should be placed in your HTML just before the </body> tag (near the bottom of your HTML file). I highlighted the name of the external JS file.

<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>



What does this do?
This code says wait for the entire document to load, then load the external file "defer.js".

Why does it matter?
It matters because Google is judging page speed as a ranking factor and because users want fast loading pages. It also matters a great deal for your mobile seo. Google measures your page speed from the the time it is called to when the page is initially loaded.
Как увеличить производительность CSS-in-JS в 175 раз

https://itnext.io/how-to-increase-css-in-js-performance-by-175x-f30ddeac6bce
Как загружать шрифты так, чтобы побороть FOUT и сделать Lighthouse счастливым

https://css-tricks.com/how-to-load-fonts-in-a-way-that-fights-fout-and-makes-lighthouse-happy/
Повышение скорости рендеринга страницы с помощью только CSS

https://blog.bitsrc.io/improve-page-rendering-speed-using-only-css-a61667a16b2