Optimizing Javascript Plugin Code Loading Asynchronously

Javascript Asynchronous Loading

Did you know that adding a JavaScript code to your website needs with asynchronous mode can alleviate the performance of your blog when loading. Asynchronous JavaScript or commonly called the async javascript is more SEO friendly as it can speed up loading of your blog. This is because in the programming techniques JavaScript Plugin Code/API will not overload browser and reduce blocking of page rendering when loading with asynchronous mode into your website.

If you adding button social media to share your page, then in fact it will weigh on the performance of the browser, so it will reduce the loading speed of your website into the browser. So if you do a test with SEO Tools, it will reducing scores of your website significantly. Try to test your website using gtmetrix.com and see the results.

Prefer Asynchronous Resourc

Three JavaScript Plugin Code/API Most Frequently Used

There are three JavaScript Plugin/API codes of social media is most often used in websites, namely Facebook, Twitter and Google Plus. I'll give it 3 ways adding JavaScript Plugin/API code into your website Asynchronously.

Facebook

To load the Facebook Javascript Plugin Code with Asynchronous mode, you replace old Facebook Javascript Plugin Code, with copy and paste code below, right after <body> tag.
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;js.async=true;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Twitter

To load the Twitter Javascript Plugin Code with Asynchronous mode, you replace old Twitter Javascript Plugin Code, with copy and paste code below, right before </body> tag.
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=true;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

Google Plus

To load the Google Plus Javascript Plugin Code with Asynchronous mode, you replace old Google Plus Javascript Plugin Code, with copy and paste code below, right before </body> tag.
<script type='text/javascript'>
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>

Do not underestimate the slightest to optimize the performance of your website, as this will greatly affect your website SEO.

He is a software developer; He try to write articles about the ideas, opinions, fantasies, experiences and desires related to IT issues and useful life; and He hopes everything that he write can be useful for the good of us all.

Share this

Related Posts

Previous
Next Post »