Lessons

Long JavaScript

All browser JavaScript code is executed in a single execution thread. This means that all scripts, even asynchronous ones, are executed strictly sequentially. That is, JavaScript does not have parallel calculations in the browser.

If you connect the script of an online consultant, maps, captcha, analytics counters on the page, they will be executed immediately. This will delay the display of really important content.

The execution rate of a separately loaded JavaScript file is 0.05 seconds. And for all inline scripts in the HTML code of the page - 0.15 seconds.

To fix this, download third-party service scripts as follows: - Counters, online consultants, maps (with the exception of the one located on the first screen), third-party authorization systems (VK ID, Yandex ID, etc.) need to be loaded at this stage so that they do not slow down the page loading in any way. To make it better with the help of construction window.addEventListener("load", (event) => { setTimeout(function() { // Here is a call to the loading code }, 50); }); or jQuery version $(window).on("load", function(event) { setTimeout(function() { // Here is a call to the loading code }, 50); }) - Captchas need to be uploaded when the form starts filling out. That is, by the focus event of the form field. - All kinds of analytics systems, except the main one, should also be downloaded through this event. For example, if you use Yandex.metrica and Google Analytics, then you can download Yandex.Metrica immediately, and Google analytics through the construction shown in the first paragraph.

Check your website
It's free and will take from 11 to 45 seconds

We use cookies. By continuing to use the site, you agree to the processing of personal data in accordance with privacy policy. I agree