Web Development Blog

Twitter

18 Mar, 2009

10 Website Optimisation Tips for Web 2.0 Websites

Web Development » Tutorials » 10 Website Optimisation Tips for Web 2.0 Websites

After optimising a few web 2.0 websites for speed and download time, I would like to share with everyone some of the tips I have learned and implemented during the process.

1. Use image sprites
If you use a lot of background images in CSS, it’s a good practice to put all the images you need in one big canvas. You can then set background-position in CSS to get the image you want from the big image. The advantage here is that instead of having to make numerous HTTP requests on a page, the browser only needs to make one request for the big image and thus speeding up load time. Some people usually create a sprite for images of the same purpose, for example, a sprite for navigation images, a sprite for logo images, a sprite for footer images, etc, but there is no reason why you can’t create combine all images, be it navigation, icons or footer, in one single sprite.

Examples of an image sprite: AOL, Digg

2. Combine Javascript files
If you are building a web 2.0 website, it is probably very likely that you will have multiple javascript files. For example, you might have one for jQuery, a few for various jQuery plugins, one for your own custom functions, etc. Instead of calling them one by one in your html, you can put all scripts in a single Javascript file to reduce HTTP requests.

Instead of this:

<script type="text/javascript"
src="scripts/jquery.js"></script>
<script type="text/javascript"
src="scripts/jquery.newsticker.js"></script>
<script type="text/javascript"
src="scripts/jquery.scroller.js"></script>
<script type="text/javascript"
src="scripts/jquery.datepicker.js"></script>
<script type="text/javascript"
src="scripts/jquery.dragdrop.js"></script>
<script type="text/javascript"
src="scripts/custom.js"></script>

Use this:

<script type="text/javascript"
src="scripts/jquery.js"></script>
<script type="text/javascript"
src="scripts/scripts.js"></script>

3. Use Code Libraries when possible
If you’re using a common Javascript library, it is advisable to use Code Libraries like Google AJAX Libraries API because it is likely that the browser might already have the javascript file in cache from some other websites that uses the same code library and hence speed up the loading time. Another advantage is that you can have the latest stable version of the library without having to manually update your code.

Instead of this:

<script type="text/javascript"
src="jquery-1.3.2.min.js"></script>

Use this:

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

4. Optimise CSS
It is important to write a clean and readable css file but when you’re deploying your website to a production environment, the readability of CSS files doesn’t matter so much compared to having a speedy website. Therefore, it is advisable to optimise your CSS files before deploying them onto a production environment. Some of the CSS optimiser I have used are Clean CSS and CSSTidy.

5. Minify or Pack Javascripts
Web 2.0 websites rely heavily on AJAX and Javascript and you can reduce the size of these Javascript files further by minifying or packing them. You can use this online tool to compress your Javascript files using the above algorithms.

6. Write a clean and semantic markup
If you think <table> are faster to code and prefer using <table> for layouts, chances are you haven’t probably had a lot of practice with semantic markup in xHTML and CSS. A clean and semantic markup not only renders on browsers faster, it also separates content from presentation (layout) and makes maintenance much easier.

7. Use a caching method
There are a number of caching methods you can use to speed up a website load time. However, if you are not able to speed up the web server or web applications at the server level, here is a simple caching method you can use with .htaccess file. It simply sets the expiry header and cache control for browsers so the browser keeps certain components in its cache and retrieve them from the cache rather than making a new HTTP request each time.

#604800  = 1 week in seconds
<FilesMatch "\.(gif|jpg|jpeg|png)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>

#86400 = 1 day in seconds
<FilesMatch "\.(js|css)$">
Header set Cache-Control "max-age=86400"
</FilesMatch>

8. Preload or postload certain components
Sometimes, you might want to preload certain components before they are required. For example, Google Search preloads some of the images it requires in the search result page on search homepage, thereby, reducing the time it takes to load search result page. And other times, you do not need to load all content on a page at once. For example, you may have a photo gallery with 50 images, but you do not need to load all 50 images on page load, rather, you can use lazyloading method or use AJAX to load images required on request.

9. Keep components sizes small
It is always recommended to have small components and objects in your page. This includes flash objects, multimedia components, images, scripts, css, and the html file itself. Simple measures like optimising images, removing extra line breaks, comments and whitespaces in scripts, css and html files, de-duplicating content and using shorthands appropriately can make a big difference in the size of a component. The ideal size of a component is between 20K – 50K (the smaller, the better!).

10. Benchmark and Test
Always benchmark, test and optimise more whenever possible. I use Firebug Network Monitoring Tool and YSlow for this purpose.

Other similiar posts that you might be interested in:

3 Responses to "10 Website Optimisation Tips for Web 2.0 Websites"

1 | kelmen

July 15th, 2009 at 4:54 pm

Avatar

great information and useful tips, i’ve learned a lot from here!

2 | krishna

September 8th, 2009 at 8:24 pm

Avatar

how to display our url name at top position by related words as vcare vcareinternational etc

3 | Best Free Ads

November 16th, 2009 at 10:19 pm

Avatar

Good blog regarding website tips on Optimisation

Comment Form

ebook
Subscribe to our newsletter and receive FREE e-book "7 Days Exercise to Build More Traffic To Your Blog"
Your name:  
Your email:  

  • About
    The blog Web Development Blog is where I keep myself up to date with the latest technologies in the industry and share my ideas and thoug...
  • Adsense Tips and Tricks
    With personal and commercial blogs, community websites, and social pages becoming the hot topic of the Internet in the last few years, many...
  • Advertise With Us
    Web Development Blog is a blog about Web Development, Web Design, Web Applications, Web 2.0, AJAX, Search Engine Optimisation, Latest Techno...
  • Archive
    Grab yourself a cup of coffee or tea, sit back and browse through an archive of all the blog posts on Web Development Blog....
  • Choosing a Content Management System
    The most commonly asked question when it comes to Content Management System is whether to build or buy (pre-built). While there are many fa...
  • Coupons
    Use the following coupon codes, promos and discount codes to save money on web hosting, domain names, website templates, ebooks, software, p...
  • Customised WordPress Themes
    If you would like a customised WordPress theme for your blog or your website, read on: (or head to WordPress Themes page to get free WordPre...
  • Favourite Poems
    If by Rudyard Kipling If you can keep your head when all about you Are losing theirs and blaming it on you, If you can trust yourself w...
  • Favourites
    Books Web Development Books Magazines Glamour Reader's Digest Software Adobe Photoshop CS4 Trend Micro Antivirus + Antispyw...
  • How to Start a Blog?
    What's a blog? According to Wikipedia, a blog is a user-generated website where entries are made in journal style and displayed in a reve...
  • Introduction to JSP Standard Tag Library (JSTL Basics)
    Tag libraries to include in your .jsp page <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> &l...
  • Links
    Free Anonymous Proxy Increases your privacy and security on the Internet by using our free, fast and easy to use web proxy. data backu...
  • Making a Passive Income Online
    Passive income, in my opinion, means an income which does not require a lot of regular maintenance work or continuing effort. I have been t...
  • Online Distribution Channels
    One of the importances of any website or business is to bring your products or services to the right people and to reach the target audience...
  • Recent Projects
    Followings are some of the recent projects I have done in 2006 -- 2007. Check out my latest business venture Web design Sydney to get your...
  • Recommended Web Development Books
    Many developers often ask me what books I read and what books I recommend in regards to web development and web technologies such as AJAX, J...
  • Search
    Looking for something on Web Developement Blog? Use this search tool powered by Google Custom Search to find what you are looking for just ...
  • Seven Tips to Building an Online Presence for your Business
    1. Get a domain name for your business The first and foremost step in building an online presence is to secure a domain name for your busi...
  • Seven Tips to Increasing Your Website’s Traffic Using SEO
    SEO is the buzz word - many people have mentioned it and many have heard of it too, but very few people know how to implement it properly. ...
  • Subscribe
    Newsletter [newsletter] RSS 2.0 feeds Entries feed Comments feed Subscribe using your favourite web-based or desktop feed r...
  • Useful Linux Commands
    Find files older than 60 days find * -mtime +60 Delete files in backup folder which are older than 60 days rm -f `find /backup/ -mtime ...
  • Web Design Tips
    Nowadays, having a website for your business is like having a phone number. Almost every business has their own website, with their own doma...
  • Web Development Books
    Many developers often ask me what books I read and what books I recommend in regards to web development and web technologies such as AJAX, J...
  • Web Hosting Comparison Chart
    The following are some of the most popular web hosting providers. I have personally used the recommended ones. Hosting coupon codes will ...
  • Web Standards
    Web Standards is defined as a set of rules or specifications that should be followed when developing a website.  The main objectives o...
  • WordPress Themes
    All WordPress themes are designed and coded by esn studio, and licensed under GPL license. If you would like a customised WordPress theme fo...
  • Sam: Useful. I always forget the rel target one
  • Chronic Tinnitus: Hi, Thanks for taking the time to discuss a really confusing matter - I find Plesk so much more awkward than the cpanel that I'm used to. Thanks Chr
  • Serhiy: I personally liked the web hosting comparison chart. Especially the recommended *. I got Bluehost :) .-= Serhiy´s last blog ..

Interests

Web development, Web design, Open source technologies, Portal development, APIs, Web services, Social media applications, Search engine optimisation, Mobile application development, iPhone Apps, Web 2.0, Web 3.0, Latest Internet technologies

Misc.

  • bluehost Hosting $6.95/month
  • Joomla Templates