![]() In Amit’s solution, the DOM is parsed by JavaScript on document load, and each call to a YouTube video (through a special div, not a regular iframe) is replaced by a thumbnail preview to which is attached the iframe when clicking on it. It was previously proposed by Amit Agarwal in April 2013. The solution I’m proposing in this article can reduce those numbers to 1 request and about 50kb per video, along with a few bytes of JavaScript (on top of the jQuery library if you don’t like vanilla flavor).Īnd you know what? This solution is not new. 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. What more to ask? Well, there’s a hidden price tag: Videos are slow and heavy to download, even when the visitor is not watching them. ![]() Videos illustrate our textual content, bring life to it, and are often served by a third party. This is where embedding videos enters the scene. ![]() But we want to keep users on our pages, and be entertained. We want our visitors to get our content as fast as possible, which means the content needs to be light, and with the minimum number of requests.
0 Comments
Leave a Reply. |