Efficient Method of Adding YouTube Videos to Your Blog

I recently upgraded my hosting provide (more on that later) and also made some modifications to my blog including a caching plugin, WP Super Cache, as well as a CSS minifier, WP Minify, in order to speed up website loading.

One thing that I noticed that took the longest on my site to load was the Flash, CSS, and javascript related to embedding a YouTube using the standard IFRAME tags, essentially what you do when you get the embedding code from the YouTube video page. This adds around ~400KB to the website size, not much but it adds up. A great work around is to load a thumbnail of the video with a play icon overlaid. The background data only loads when the play button is actually clicked.

The code can be found here: Labnol.org: A More Efficient Embedding Method for YouTube Videos

1 thought on “Efficient Method of Adding YouTube Videos to Your Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge