Today i will discuss about How to suspend Google plus, twitter and Javascript loading to boost web site speed
If you're a web site or blog owner like me then you may have known the actual fact that Google these days highlight on having speedy websites. You may have an excellent probability to rank higher in Search engine Google search if your web site opens earlier than your competitors.


You might have done many twists to boost your website speed for higher expertise of your guests and you may have used either Google PageSpeed Checker or Gtmetrix to see the web site speed.
A lots of people face this javascript suspend trouble.

So, I’m reaching to give you the answer to suspend your outdoor JavaScript loading.
Use the following code between {</head>} the head tags in your web site.

JavaScript Source code

<script>
// Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>

Google plus Code:

<script>
(function(d, t) {
    var g = d.createElement(t),
        s = d.getElementsByTagName(t)[0];
    g.src = '//apis.google.com/js/plusone.js';
    s.parentNode.insertBefore(g, s);
}(document, 'script'));
</script>


Any external JavaScript code:

<script>
(function(d, t) {
    var g = d.createElement(t),
        s = d.getElementsByTagName(t)[0];
    g.src = 'Your external javascript code';
    s.parentNode.insertBefore(g, s);
}(document, 'script'));
</script>



Twitter Code:

<script>
(function(d, t) {
    var g = d.createElement(t),
        s = d.getElementsByTagName(t)[0];
    g.src = '//platform.twitter.com/widgets.js';
    s.parentNode.insertBefore(g, s);
}(document, 'script'));

0 comments:

Post a Comment

Thanks a lot for your nice compliment!!