If a website wants to retain people, speed is very important. Now I will write down some feelings about website optimization.
First, we must help the page lose weight and remove useless extraneous stuff. When we browse the web, we actually download the web content in the virtual host to the local hard drive, and then use the browser to interpret and view it. The speed of downloading web pages 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 will be. This requires that you follow the principle of simplicity when making web pages and do not use too large Flash animations, pictures and other resources. A clean, concise page will give people a sense of clarity.
Try to use static HTML pages. As we all know, ASP, PHP, JSP and other programs realize the dynamic interaction of web page information. They are indeed very convenient to run because they have good data interactivity and can easily access and change the contents of the database, making the website "moving". Such as: forums, message boards, etc. However, this type of program must first be processed by the server, generate an HTML page, and then "send" it to the client for browsing, which has to consume a certain amount of server resources. If you use this type of program too much on a virtual host, the display speed of web pages will definitely be slow, so there is no need, please try to use static HTML pages.
Stuff the entire page content into a Table. This is a problem of web design. In order to pursue unified page alignment, many webmasters stuff the entire page content into a table, and then use cell td to divide the layout of each "block". The display of this kind of website The speed is absolutely slow. Because the Table will not be displayed until all the content inside is loaded, if some content is inaccessible, it will delay the access speed of the entire page. The correct approach is: divide the content into several Tables with the same format, rather than stuffing them all into one Table.
Change access to ASP, ASPX, PHP and other files to .js references. This should be noted when designing programs such as ASP, ASPX, PHP, etc. If you want to embed dynamic data in a static HTML page, and these dynamic data are provided by ASP, PHP and other programs, you will use the following statement Quote, in this case, every time someone visits your website, the server will execute and process the tongji.asp file, extract the corresponding data from the database, and then output it to the web page for display. If tens of thousands of people visit at the same time, it will If executed tens of thousands of times, the consequences can be imagined. It is recommended to dynamically generate data into a 1.js file in these programs, and then use code like <SCRIPT c=" http://www.XXX.com/1.js ">< /SCRIPT> on the homepage. Reference the 1.js file. In this way, the task of data display is left to the client's browser, which does not consume server resources, and the display speed is naturally very fast. There are a large number of js references in the home page file of the website. The js content is automatically generated through the background program, so the access speed is very fast.
Use an iframe to nest another page. If you want to insert some advertising code on your website and don't want these advertising websites to affect the speed, then using iframe is the most suitable. The method is: put these advertising codes into a separate page, and then use the following code to embed the page on the homepage, so that the display of the entire homepage will not be delayed due to the delay of the advertising page. The code is as follows:
< iframe align="center" width="780" height="30" name="all" scrolling="no" marginWidth=0 frameborder="0" src=" http://xx/headToolBar.jsp "></ iframe>
where http://xx/headToolBar.jsp is the referenced file path.
Pay attention to the skills of website counter code placement. Placing counters in web pages can count website traffic and provide access basis for webmasters and advertisers. However, no matter how powerful the website statistics system is, there will always be failures. If you put the statistical code directly in front of the page content, or put it in a Table or div tag, then when the counter cannot be accessed, the Table or div on your page will cause a delay of tens of seconds, causing the page Takes a long time to access. Therefore, in order to improve the speed of the website, we must pay attention to the placement of the statistical code. The correct method is: put the statistical code at the bottom of the page, and do not place it in the same Table or div tag as the page content. You can place the statistics code directly at the bottom of the page code, or make a separate Table or div at the bottom to place the counter. In this way, your website speed will not be affected at all when the counter is inaccessible.
Problem with friendly links. Linking websites to each other can increase the publicity effect of the website. Linking LOGO pictures can more accurately describe the theme and positioning of the website, and the publicity effect will be greatly enhanced. However, too many picture links will inevitably affect the display speed of the web page. . Many webmasters like to directly quote the picture URL on the friendship website, so that the picture must be loaded first before it can be displayed. The access speed of each friendship website is different, and the entire table must wait for the picture to be downloaded before it can be displayed, which greatly reduces the time required. Page speed. Therefore, when making friendly links, you should try your best to: only make text links: making text links will not delay the speed of the web page. Put all links into a separate page, and then link to that page on the home page. If the friendly link must appear on the homepage, please place the entire Table where the link is located at the bottom of the page. Because the page is displayed line by line from top to bottom, placing it at the bottom of the page will not delay other content. show. The LOGO image of the friendly link is downloaded first and then transferred to your own web space. In this way, the speed is determined by your own web space and is not affected by the friendly website.
In short, there are many ways to optimize website speed, especially in the early stages of website construction, static page display + architecture should be used. Only in this way can website access speed be fundamentally improved.