A user of any website cannot wait for more than 5 seconds for webpage to load. In order to make a website user friendly the website should be fast loading. You can speed up the website by 10 simple practices.
1. COMPRESSING IMAGES:
If website consists of images it is always a good practice to compress the images and then use it in html. This helps in using less memory space and page loads faster and easy.
2. Using Stylesheets in the HEAD:
It’s always advised that placing stylesheets in the document HEAD helps loading the page faster, rather than placing the script at the bottom. The main issue with placing the style sheets at the bottom is that, in many browsers it does not load the page accordingly.
3. CSS Sprite:
CSS Sprite is one large image which consists of many smaller images. If there are 5 images in a website they all together can be combined into one image. This helps in loading only one image rather than 5 different images. This makes page loading fast and easy.
4. Minifying HTML, JAVA SCRIPT, CSS:
Minification is nothing but removing the unwanted characters like whitespace, comments from code which are written only for readable purpose. This deletion of the characters from the code does not effect the main execution of the program.
For Minifying your webpage you can use Google’s Minify Resources
5. Java Scripts and CSS Files:
Most preferable and easiest way to use java script and CSS files is by making them external and they can be called when needed. By using external files the page loads faster because the files will cached by the browser. If the java script and css files are inlined in the html page, each time the request is sent for html , the files are downloaded and takes more time to load the page.But if the css and java script files are made external, the files once downloaded are cached and hence makes loading page easy when a html document is requested. The java script and css can also be combine in one file and this makes the pages to load fast.
A content distribution network is a group of web servers located in different parts of the world to deliver content to the users. Servers will be placed at different locations based on the network proximity.
Hence by deploying the website in different servers located in multiple locations helps the content to reach the users more efficiently and helps in loading webpages faster.
7. Avoid Redirection:
Generally redirection are used when connecting from one website to another. This redirection needs a small extra code and is easy for the developers but may degrade the user experience. Instead of using redirects you can use Alias and mod_rewrite if both code paths are hosted on the same server.
The most efficient and best practice is to keep the cookie size as low as possible so that the impact on the users response time is minimum. When cookies are not used remove the unnecessary cookies. If the cookies size is low the response time improves.
When a browser sends a request for static images and cookies are sent with the requests but the server does not need any cookies, instead they only create network traffic .
9. CSS Expressions:
CSS expression is said to be powerful way to set CSS properties dynamically. The CSS property is to result the evaluating java script expressions. This is useful in internet explorer to create a consistence in all the browsers. But the problem is that the CSS expressions get evaluated more than expected times that is even when the page is scrolled down it is evaluated and also by moving the mouse also it is evaluated.
Since more number of evaluations may cause problem in loading page and many, the best practice is to use avoid expressions or reduce expressions to minimum.
The image loader filters aim to fix the problem with semi -transparent true colour PNGs. But here is a problem with those filters that is it freezes the browser while loading image and also increases the consumption of memory. So it is always better to not to use filters.