Defer JS Blogger Comments To Speed Loading Blog

Defer JS Blogger Comments To Speed Loading Blog - Initially I wanted to further optimize loading Blogokay.com in order to become lighter. One of the things that contribute loading blog is loading Blogger comments. Although, blogger comments (commentators) are already using a profile photo with a small size 35px ( previously using 512px size ) but the loading of javascript commentary still make impact to your loading blog. Then I casually tried downloading defer (delay loading) javascript blogger comments and it can also be carried out, this time I hosted it on Google Drive but my advice try using selft hosting to make it be better.

If you are using Threaded Comment Hack, then there are two groups javascript must be hosted and later re-defer. It was quite difficult to customize. If you are using Default Blogger Comment, only one group javascript hosted and later re- defer.

Note : This tutorial just for you that using Default Blogger Comment on your blog. If you have already using Threaded Comment Hack please contact me for help, I will try to help you.

Please find the following code <b:includable id='threaded_comment_js' var='post'> after the meet please do as the first step and give it a different name for js. So that we easily recognize, for example threaded-comment.js. However differentiate to defer its javascript in order not to conflict be as follows :

function downloadJSAtOnload2(){var d=document.createElement("script");d.src="URL hosting threaded-comment.js here",document.body.appendChild(d)}window.addEventListener?window.addEventListener("load",downloadJSAtOnload2,!1):window.attachEvent?window.attachEvent("onload",downloadJSAtOnload2):window.onload=downloadJSAtOnload2;

Simply, how to add the number 2 on downloadJSAtOnload. So that in the second step is the appearance of HTML edit it becomes like below.

  <script type='text/javascript'>
    (function() {

      var items = <data:post.commentJso/>;

      var msgs = <data:post.commentMsgs/>;

      var config = <data:post.commentConfig/>;

       //<![CDATA[

function downloadJSAtOnload2(){var d=document.createElement("script");d.src="
URL hosting threaded-comment.js here",document.body.appendChild(d)}window.addEventListener?window.addEventListener("load",downloadJSAtOnload2,!1):window.attachEvent?window.attachEvent("onload",downloadJSAtOnload2):window.onload=downloadJSAtOnload2;
//]]>

 
</script>

If you want to try , please read carefully , if there are less understood please ask in the comments .
Advertisement

Tidak ada komentar