Home arrow PHP arrow Page 5 - Speed up Web Page Loading Using Google Page Speed

Optimizing the Order of JavaScript and CSS - PHP

The easiest way to improve your website's conversions may have less to do with SEO and your content and more to do with how fast your pages load. Internet users have a short attention span, and won't wait for your pages to load when the next site is just a click away. Fortunately, you can fix your web page loading times with the help of Google Page Speed.

TABLE OF CONTENTS:
  1. Speed up Web Page Loading Using Google Page Speed
  2. Introduction to Google Page Speed
  3. Page Loading Improvement Case Study
  4. GZIP Compression for CSS Files
  5. Optimizing the Order of JavaScript and CSS
By: Codex-M
Rating: starstarstarstarstar / 6
February 01, 2010

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
  

Optimizing the order of JavaScript is simple. You will need to cluster all JavaScript together as one group if possible, and let them execute first, before loading the CSS. This will benefit from any parallel loading of scripts which have an effect on loading speed. For example, if before it was:

 

<?php

//javascript groups in the header placed here

?>

 

<link rel="stylesheet" href="http://www.php-developer.org/wp-content/themes/arras-theme.1.3.5/css/layouts/2c-r-fixed.css" type="text/css" />

 

<script type="text/javascript">

     jQuery(document).ready(function($) {

          $('.sf-menu').superfish({autoArrows: false, speed: 'fast'});

     });

</script>

You can improve the first step by placing JavaScript above the CSS and grouping it (combining it) with the rest of the JavaScript.

<?php

//javascript groups in the header placed here

?>

<script type="text/javascript">

     jQuery(document).ready(function($) {

          $('.sf-menu').superfish({autoArrows: false, speed: 'fast'});

     });

</script>



 
 
>>> More PHP Articles          >>> More By Codex-M
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: