Speed ​​up web display

The speed of web page display depends on many factors such as connection speed, server processing speed, website content and client computer processing speed. To increase the speed of web page display, it can be divided into 3 parts to handle as follows

The speed of web page display depends on many factors such as connection speed, server processing speed, website content and client computer processing speed. In order to speed up the display of the website, it can be divided into 3 parts to handle the following :

- At the server: Minimize server calculations, optimize databases, create buffers, optimize programs .

- Transmission: Minimize data transmission on the network by reducing the size of image files, reducing the need for data exchange between server and client .

- At client machine: optimize html code for browser to display quickly.

With the above strategy, here are 10 tips that can help speed up website display.

1. Use CSS to define the properties of objects in web pages

Using CSS will help improve the loading speed of web pages significantly. The browser will only download CSS files to the client machine once, the next time the web pages using this CSS file will be retrieved from the client. Focusing all of the attribute definitions into the CSS file makes the HTML snippet short and clear and helps reduce the size of the web page.

Another convenient point when using CSS files is that you can change the colors and appearance of web pages quickly by editing the properties in the CSS file.

2. Write Javascript on a page and use it for multiple pages

This is similar to the technique of using CSS files for every web page. For example, the JavaScript code displays ads for multiple pages, if you write the entire Javascript code in a file then declare it on the following pages:

Like CSS files, the browser only downloads this file once.

3. Use AJAX

AJAX stands for Asynchronous JavaScript And XML, this technique uses Javascript and XML to optimize data exchange between client and server. Suppose your site contains a lot of information, including a section containing 2 combobox: Country and City. When you select a country on combobox 1, then the corresponding combobox 2 cities will appear. In the usual way, when selecting a country, its parameters will be sent to the server. Here the content of the website is recalculated and returned to the client with combobox2 containing the cities of the selected country. So only a small part of the site changes but must download the entire site and render. With AJAX, after processing, the server only sends the result to the client list of cities, not the entire site. This greatly improves the response speed of the website.

4. boldly remove what is not needed

Remove flash and audio files if they are not really needed. In addition, for web developers, using HTML control instead of server control of ASP / JSP . also helps reduce compile time (from ASP / JSP . to HTML).

5. Avoid using nested tables in tables

When you write the nested table in the table, the browser will take longer to display the web page. This is the least noticeable thing but is a technique to improve the most significant website display speed. When you place a table inside a table, it will take a long time for the web browser to browse the entire code within each table and then make the presentation on the screen for the user to see. If possible, use CSS to create lines and columns for web pages.

6. Do not use the table to cover the entire content of the website

If you use a large table to create the layout for the site as follows:

Picture 1 of Speed ​​up web display

The browser will have to download all the information of the components in the table including: Top, Left Menu, Content . to the client, and then calculate and calculate all control, whitespace, images . inside the table. When everything is complete, the web browser will display the contents of the table on the screen at the same time.

If you do not use the table to cover the entire content of the website, in addition to reducing the website size, the processing time is displayed at the client, it also allows the web browser to display partially processed, for Users have some information to read first, while waiting for others to continue to display, this gives users the feeling that your website has a fast display speed.

7. Split web pages into smaller pages

Instead of displaying all the information on a web page, divide the web page into small sections and display it on many different pages. Like Yahoo Mail, you can only view 50 emails on the screen at a time, to see a list of other emails you have to click the next / previous link .

This not only helps to speed up the display of websites, but in fact, most users really do not like to wait for a few minutes to see a website with a long content, to use scroll bar to view out of content.

8. Delete unnecessary spaces

Try to delete all unnecessary spaces in the html code. Remember that pressing a space key increases the size of your website by 1 byte. Removing this space can be done by hand or using support tools such as HTML code Cleaner (can be found with Google).

9. Clean up the program code for clarity

Please remove all blank tags like div>

good. Not only does this improve website capacity, speed up the display, but also make your code clear, making it easy to edit or upgrade.

10. Optimize images

Restricting the use of images : Images make your website come alive and attractive, but images are also one of the reasons that slow down the speed of website display.

Specify the size of the image : When the browser displays the image of the web page, it must know the size of the image so that it can leave space on the screen for displaying this image, and the display will in the top down order. If you do not specify the size of the photo (for example: ), the browser must download the previous image to determine the size before processing the display content. This is similar to using the table to cover the entire content. So if possible, you should use the declaration 'width', 'height' to specify the size of the image in advance.

Reduce image size : Minimize the image size. Sometimes you don't need to upload a website with high quality images that can use thumbnails instead. GIF / JPG format is the first choice for websites because of its small size.

Example of using CSS instead of table

3 ways to display a simple login form:

- Use the board
- Do not use tables
- Do not use tables and use CSS

1. Use the board

Picture 2 of Speed ​​up web display

The result of the above code will look like the image below

 

Picture 3 of Speed ​​up web display

2. Don't use tables

Picture 4 of Speed ​​up web display

The result of the above code will look like the image below

Picture 5 of Speed ​​up web display

3. Use CSS

 

From the second way above if you define CSS for Label object and Submit Input as below, you will get result like way 1 without using table.

Picture 6 of Speed ​​up web display

The result after defining the CSS for the Label object and Submit Input

Picture 7 of Speed ​​up web display

Now, if you want to add color and create a frame you can use tags

Picture 8 of Speed ​​up web display

HTML code

Picture 9 of Speed ​​up web display

Tag inside the tag

will create a header for the frame around the form content, the result will look like the image below.

Picture 10 of Speed ​​up web display

These are just basic optimization techniques for HTML code. See you in the following articles about website optimization techniques with database code, VB, C #, JSP .

Duong Quy Phuong
www.viettechs.com
-----------------------------------------------
Reference :
1. http://www.webcredible.co.uk/user-friendly-resources/css/css-forms.shtml
2. http://www.webweaver.nu/html-tips/load-time.shtml

Update 25 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile