June 26, 2018

Defer Parsing Youtube Video to Speed Up Loading in Blogger

Since my blog is back in Blogger, only a few days ago embedded iframe Youtube videos were installed again in their respective posts. That's because I had found a way to enable defer parsing Youtube Videos to Speed Up Loading in Blogger. If one installs Youtube videos without performing defer parsing or defer loading then it will adversely affect the loading speed of post, which would not be good for visitors, not for search engines as well. [ Bahasa Indonesia ]

In addition to content, loading speed of posts is 'everything' for a blog owner. Anything will be done to improve page loading speed, and all things that can slow down loading will be eliminated or solutions must be sought to reduce harm.

With the increasing mobility of people around the world, more and more users are accessing web pages using mobile phones, and when high-speed wireless networks are still not available in many cities, light and fast loading of pages are still very important.

To see the effect of an embedded iframe Youtube video in a post to load speed, you may do a test with GTmetrix. First check the speed before installing a Youtube video in a post, and then check the speed and the GTmetrix scores after Youtube video is installed in the post.

How to do a defer parsing Youtube video to speed up loading in Blogger in this post is using a script for WordPress that I found somewhere and modified it by adding a 'container', so it can be used in Blogger or Blogspot.

defer parsing video youtube untuk mempercepat loading di blogger
To do a defer parsing Youtube video in Blogger, please follow the steps below, and before making any changes do not forget to make backup, as a precaution in case of there's a mistake during the process:

  1. Login to Blogger --> Theme --> Edit HTML.
  2. Place followng script before </body>

    <script type='text/javascript'>
    //<![CDATA[
    function init() {
    var DeferParse = document.getElementsByTagName('iframe');
    for (var i = 0; i < DeferParse.length; i++) { if (DeferParse[i].getAttribute('data-src')) { DeferParse[i].setAttribute('src', DeferParse[i].getAttribute('data-src')); } } } window.onload = init; //]]> </script>
  3. Save.
  4. Next is to copy paste embed iframe Youtube video into a post, which is usually like this :

    <iframe width="560" height="315" src="https://www.youtube.com/embed/2oULsdRPVuw" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

    and add 'data-' before src, to make it like this :

    <iframe width="560" height="315" data-src="https://www.youtube.com/embed/2oULsdRPVuw" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

Next, check again the loading speed of the post in GTmetrix. If everything goes well, then there will be a very significant increase in loading speed when compared to the score before installing the defer parsing Youtube video script. Please read also the posts Embedded Iframe Youtube Video Responsive 100% Width.
Label: Blog, Defer Parsing, Youtube
Bagikan ke: WhatsApp, Email. Print!.

aroengbinang, seorang penyusur jalan.
Traktir BA secangkir kopi? Scan via 'Bayar' GoPay.