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 than to seek a better space. Code To get a satisfactory speed. 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, etc.ProgramIt enables dynamic interaction of webpage information and is very convenient to run. Because of their good data interaction, it is easy to access and change the database content, so that the website can be "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, it will be referenced using the following statement: in this way, every time someone visits your website, the server will execute and process Tongji once. ASP files, extract the corresponding data from the database, and then output the data to the web page. If tens of thousands of people access the data at the same time, tens of thousands of times are required. We recommend that you dynamically generate data to a 1. JS file, and then on the home page through the <SCRIPT src = "http://www.XXX.com/1.js"> </SCRIPT> such code to reference this 1. JS file. Upload file. You can access www.25cn.net/index3.htmand www.25cn.netto compare the time spent by the previous person!
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 marginwidth = 0 marginheight = 0 src = "http://www.ftp8.com/index.asp" frameborder = 0 width = 468 scrolling = No Height = 60 leftmargin = "0" topmargin = "0"> </iframe>
Htthttp: // www.ftp8.com/index.aspis the region of the referenced file.
6. Website counter code placement skills
Placing a counter on a webpage can count Website access traffic and provide access basis for webmasters and advertisers. However, no matter how powerful the website statistics system is, there will be faults. If you directly put the Statistical Code in front of the page content, or put it in a table or Div label, when the counter cannot be accessed, the table or Div on your page will have a delay of dozens of seconds, resulting in a long time before the page can be accessed. Therefore, to speed up the Website, you must pay attention to the location of the statistics code. The correct method is to place the statistics code at the bottom of the page, and do not use the same table or Div label as the page content. You can directly place the Statistical Code at the bottom of the page code, or create a table or DIV at the bottom to place the counter. In this way, when the counter cannot be accessed, your website speed will not be affected at all.
7. Knowledge of friendship links
Links between websites can increase the promotion effect of websites. logo image links can more accurately describe the themes and positioning of websites. The promotion effect will be greatly enhanced, but there are too many image links, it will inevitably affect the display speed of the webpage. Many webmasters like to directly reference the image URLs on the friendship websites so that the images can only be displayed after being loaded. The access speed of each friendship website is different, the entire table can be displayed only after the image is downloaded, which greatly reduces the speed of the webpage. Therefore, we should try our best to do the following for friendship links:
1. Only text links: text links do not delay the speed of webpages.
2. Place all links on an independent page, and then click the page on the homepage link.
3. if the link must appear on the homepage, place the entire table of the link at the bottom of the page, because the page is displayed from top to bottom row by row, place it at the bottom of the page without any delay in displaying other content.
4. The logo image of the link is downloaded first and then uploaded to Your webpage space. In this way, the speed is determined by your website space and is not affected by the website space.
This article from: http://forum.oray.net/viewthread.php? Tid = 1694