Optimization youtube iframe loading on your website

If you use youtube Iframe on your website this approach will be interesting for you to optimize page speed.

Problem

You use the Iframe

Ускорить загрузку страницы на которой размещено видео с ютубе

probably you’ve noticed that your page is loading slower now. Especially if you have several videos on the page.

It needed 2.98 seconds on my page only for base.js which pulls player functionality. Page loading took 6.58 seconds in total. Quite long.

I found Denis Chernikiov’s solution here.

Demo

So briefly, we pull only preview images instead of extra requests. And put the play icon above the preview - so it looks like the player. So you don't do requests for youtube assets when the page is loading and only if the user wants to watch a video youtube player will be loaded.

As result, I decreased the page loading time to 3.37 seconds.

Also, you can check solutions here by stanislav.protasevich:

Categories: js

You might also like



Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.