Seven secrets to accelerating Website access

Source: Internet
Author: User
Tags web hosting

Many of my friends use web hosting as websites to store webpage files in virtual spaces. However, when there are many pages, the website can be opened very slowly. If this happens, it is better to optimize the webpage code to achieve satisfactory speed than to seek a better space. I have summarized some practical methods. When making a homepage, the following methods can greatly improve the speed of your webpage.

   I. Remember to help the page to lose weight

We browse the Web page to download the web page content from the VM to the local hard disk, and then explain it in a browser. The speed of downloading a Web page accounts for a large proportion of the display speed. Therefore, the smaller the space occupied by the web page itself, the faster the browsing speed. This requires that you follow the principle of simplicity when creating web pages, such as: Do not use too much Flash animation, images and other resources. A clean and concise page will give you a clear idea.

   Ii. Try to use static HTML pages if necessary

As we all know, ASP, PHP, JSP and other programs realize dynamic interaction of web page information, which is indeed very convenient to run, because their data interaction is good, you can easily access and change the database content to make the website "dynamic", such as forums and message boards. However, such programs must first be processed by the server, generate HTML pages, and then "send" them to the client, which consumes a certain amount of server resources. If you use too many such programs on the VM, the webpage display speed will be slow, so it is not necessary. Please try to use static HTML pages.

   3. Do not insert the entire page content into a Table

This is a problem with Web page design. Many webmasters put the content of the entire page into a Table in pursuit of unified page alignment, then, the cell td is used to divide the layout of each "Block". The display speed of such websites is absolutely slow. Because the Table is displayed only after all the content is loaded. If some content cannot be accessed, the access speed of the whole page will be delayed. The correct method is to split the content into several tables with the same pattern. Do not add all the contents to a Table.

   4. Change ASP, ASPX, PHP, and other files to. js references.

This should be noted in programming such as ASP, ASPX, and PHP. If you want to embed dynamic data in Static HTML pages, if these dynamic data is provided by ASP, PHP, and other programs, the following statements are used for reference:

     
      < script src="http://image.ccidnet.com/ad_files/network_index.asp?orders=1">< /script>
     
In this way, each time a person accesses your website, the server will execute and process the network_index.asp file, extract the corresponding data from the database, and then output the data to the webpage, if tens of thousands of people access the website at the same time, tens of thousands of requests are required. We recommend that you dynamically generate data to a network_index.js file in these programs, and then
     
      < script          src="http://image.ccidnet.com/ad_files/home_daohang/network_index.js">< /script>
     
This code references the network_index.js file. In this way, the data display task is handed over to the browser of the client, which does not consume server resources and the display speed is naturally fast. The former takes almost several times as much time as the latter!
  5. Use iframe to nest another page

If you want to insert some advertisement code on your website and do not want these websites to speed up, iframe is the best choice. The method is: place these ad codes on an independent page, and then embed the page with the following code on the homepage, in this way, the display of the entire homepage will not be dragged due to the delay of the advertisement page. The Code is as follows:

     
      < iframe frameborder=0    leftmargin=0    marginheight=0    marginwidth=0    scrolling=no src="http://tech.ccidnet.com/pub/column/c348.html"    topmargin=0 width=700 height=440 >< /iframe>
     
Http://tech.ccidnet.com/pub/column/c348.htmlis the region of the referenced file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.