Sunday, August 17, 2014

Faster YouTube Embeds with JavaScript

Faster YouTube Embeds with JavaScript

We want our visitors to get our content as fast as possible, which means as light as we can, and with the minimum number of requests. But we want to keep them on our pages, and be entertained. This is where embedding videos enters the scene.

Videos illustrate our textual content, bring life to it, and are often served by a third party. What more to ask? Well, there’s a hidden price tag: they are slow and heavy to download, even when the visitor is not watching them.

One simple video on a page called through an innocuous iframe can add up to 6 HTTP requests and as much as 450kb of content. The solution I’m proposing can reduce those numbers to 1 request and about 50kb per video, along with a few bytes of JavaScript.

If you want to know more, I invite you to read the full article on Sitepoint.

Photo credit: Mirror of Ashes

Accélérez vos pages contenant des vidéos YouTube (full article in French)
Acelere sus páginas con vídeos de YouTube (full article in Spanish)
Acelere suas páginas com vídeos YouTube (full article in Portuguese)

No comments:

Post a Comment