On how to optimize the speed of Web page opening

Source: Internet
Author: User
Tags header

The page opening speed of a website directly affects its user experience, imagine a few visitors will waste time in a load faster than 8 seconds on the page, now the Internet information everywhere, visitors can get information from many pages, how to let visitors stay on your page, Optimizing the loading speed of the site is critical.

The HTML code optimization of the Web page is the foundation of slimming the website, reducing unnecessary webpage code is the main means to optimize the client and speed up the load of the website. Code optimization is specifically about markup optimization, which not only reduces the size of the document, but also makes the document easier to maintain and improve the visibility of the search engine. Here are some common code examples that need to be optimized.

1. Delete the annotation characters in the script. In most mainstream browsers, adding HTML comments to a script block is completely unnecessary. It is estimated that the old tooth-dropping browsers did not have users in the use.

2, the event properties (such as onclick= "...", onmouseover= "...", etc.) written in the HTML tag is a very unwise way to reduce the maintainability of the code, while polluting the label. The event properties can be dynamically added through JS, not only flexible control, you can also take advantage of JS client caching, so that these event properties do not have to follow the document request each time.

3, < form method= "Get" >, the default method of form is get, so you can write without writing if you are using the.

4, < input type= "text" > Default property is Text, you can ignore.

5, < meta http-equiv= "Content-type" ... >. The character encoding of the specified file has always caused great confusion, Content-type priority is not higher than the HTTP header, when both exist, the request header is preferred, so if you can control the server response, and set the header, then the mate can safely ignore, Unless the page needs to be browsed locally.

The above is a common method of labeling optimization, for the optimization of the speed of the Web page loading, you can also use some tools for analysis and processing, the author in the previous written "skillfully using Google tools to optimize the loading speed of the home page", for its responsible for the Qilu talent Network as an example of the Web page loading speed optimization analysis, Google's Page-speed tool provides detailed web page speed optimization reports that clearly see what needs to be optimized. The main items to be addressed are:

1, the browser's cached files. A reasonable setting of the cache expiration time for picture files can improve the loading speed of web pages effectively.

2, "Specify Image Dimensions": Specify the size of the picture. When the browser loads the page, it calculates the size of the picture and increases the load time. So the size of the picture is specified to facilitate the speed of ascension.

3, the tool also provides a number of ways to optimize the code.

Merge JS file, reduce the browser to the JS file read, effectively reduce the number of HTTP requests; In gzip format compression, can significantly reduce the size of text files, thus saving bandwidth and load time;

In the Web site's CSS file, there may be some code that is not in use, this work should be in the site before the release of the Css,js file to check, delete the code is not used.

This article is provided by www.qlrc.com Webmaster.



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.