Question

Measuring with YSlow it gave my page a grade F for making too many HTTP requests. Combining all my javascript to one file will result in fewer HTTP request but is it possible in this case? I want to make my page load faster so I wonder if it's technically possible to combine everything into one javascript file or if I'm in a position where I can't simplify the components more:

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '164355773607006', // App ID
      channelURL : '//WWW.KOOLBUSINESS.COM/static/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      oauth      : true, // enable OAuth 2.0
      xfbml      : true  // parse XFBML
    });

    // Additional initialization code here
  };

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
</script><script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&libraries=adsense"></script>
<script type="text/javascript" src="static/js/home.js"></script>
Was it helpful?

Solution

there is the possibility of combining all the javascript file into one single file on the server side. but i don't think it will make a great improvement.

using Cache-Control headers appropriately to allow caches and proxies to retrieve the data more efficiently would be more efficient.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top