Website access speed can directly affect website traffic, and website visits are almost directly linked to the website's interests. Therefore, website speed has become a matter of great concern to enterprises and webmasters. Nowadays, there are more and more websites, and the opening speed of many friends’ websites is not ideal. Maybe you open the website very quickly, but others open your website but the speed is too slow. This may be caused by line problems such as China Netcom and Telecom, but mostly it is due to problems with our website itself that affect the speed. How to improve website access speed? Let’s talk about some key issues and solutions.
Many people use virtual hosts to build websites and store web page files in the virtual space. However, when there are too many page contents, the website opens very slowly. If you encounter this situation, instead of looking for better space, you can Achieve satisfactory speed by optimizing web page code. The following summarizes some practical methods. When making a homepage, the following methods can greatly improve the speed of the web page.
1. Remember to help the page lose weight.
Browsing the web is actually downloading the web content in the virtual host to the local hard disk, and then using 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, such as: do not use too large Flash animations, pictures and other resources. A clean, concise page will give people a sense of clarity.
2. If not necessary, 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 be easily accessed and changed. The content of the database makes the website "active", 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.
3. Don’t 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 (table), and then use the cells to td to divide the layout of each "block". The display speed of this kind of website 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.
4. Change access to ASP, ASPX, PHP and other files to .js references.
This should be noted when designing programs such as ASP, ASPX and PHP. If you want to embed dynamic data in a static HTML page, these dynamic data If it is provided by ASP, PHP and other programs, the following statement will be used: In this case, every time a person visits your website, the server will execute and process the tongji.asp file once, and extract the corresponding data from the database. Then output it to the web page for display. If tens of thousands of people visit it at the same time, it will be executed tens of thousands of times, and the consequences can be imagined. It is recommended to dynamically generate data into a 1.js file in these programs, and then pass <SCRIPT src=../../" http://www.aaa.com/the specific name of your js file" on the homepage >< /SCRIPT> Code like this to reference the 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!
5. Use iframe to nest another page.
For example, if you want to insert some advertising code on the homepage of the website, , and do not want these advertising websites to affect the speed, then it is most appropriate to use iframe. For example, how to insert some advertising code on the homepage of http://www.aaa.com/ : Put these advertising codes into a separate page, and then embed the page with the following code on the homepage, so that it will not Due to the delay of the advertising page, the display of the entire homepage is dragged down. The code is as follows:
The following is a quoted fragment:
< IFRAME marginWidth=0 marginHeight=0 src=" http://www.downcodes.com " frameBorder=0 width=468 scrolling=no height=60 leftmargin="0" topmargin="0">< /IFRAME>
Among them, http://www.downcodes.com/qq.asp is the path of the referenced file.
6. Pay attention to the skills of website counter code placement.
Placing counters in web pages can count the website's access traffic and provide access basis for webmasters and advertisers. However, no matter how powerful the website statistics system is, there will 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, 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.
7. The Knowledge of Friendly Links
Linking websites to each other can increase the publicity effect of the website. Making LOGO picture links can more accurately describe the theme and positioning of the website, and the publicity effect will be greatly enhanced. However, if you do too many picture links, it will inevitably Will affect the display speed of web pages. 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 do the following:
1. Only make text links: making text links will not delay the speed of the web page.
2. Put all links into a separate page, and then link to the page on the homepage.
3. 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 links. display of content.
4. 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.
8. Selection of website space
If the above methods are used and the space access speed is not ideal, then it may be a problem with the speed of your website space. When choosing a website space, it is recommended that you use a double-line space, which can avoid delays caused by network problems when other users access the website.