Page (HTML) Optimization Method
In addition to language optimization, the optimization of Web development and HTML will greatly reduce the server load and provide website performance.
1). Reduce the number of HTTP requests.
When a Web page is opened, the browser sends a lot of requests, images, scripts, and loading each object takes time and reduces the load.
1. Merge CSS and Js files to reduce the number of Http requests
2. Merge the frame image and the image with few changes, and then merge one image. Sometimes it is done directly with Css.
3. reasonably use the local Cached to cache js/css/image
2). reduce the size of the requested file and reduce the network bandwidth occupied by the requested data.
1. compress the Js volume and delete empty lines, comments, and variable names. Large JavaScript files are messy, with no blank lines or line breaks. They are actually optimized.
2. compress the CSS volume
3. Build the website structure using XHtml + Css to improve the reusability of CSS
4. Use GZip on the server to compress JS/Css files and reduce the transfer file size (16.7.2)
3). versionized control of Client Cache
1. files such as JS and CSS are frequently changed. To speed up loading, you may need to set the expiration time of these files to cache the files several days later, then our problem is how to promptly change these cached files.
2. Modify the JS version to notify the browser in a timely manner, such as: the JS file name, path, URL Rewrite, and major version remain unchanged. The minor version is continuously appended and updated after a certain period of time.
4). Help the page to lose weight. Simple Style, less Flash, etc.
5). Delete the dispensable content in the header. Such as space, comment
6). Delete the blank statement in the page code
7). Delete the default value, color, and alignment in HTMl.
8. Optimize CSS files
9. Visibility is faster than Display
When an image is present, Visibility is recommended if the position is determined. None, hidden. visibility: hindden
10. The cache area is case-sensitive and keeps url case-sensitive consistency.
11. Make the html Tag always exist. Reduces browser Judgment time
12. You do not need to add all the content to a Table. Because Talbe is displayed only after the content is loaded. If some content is incorrect, the page access speed will be delayed.
13. If there is advertisement code, put it in iframe. <Iframe src = "http://www.xxx.com/" marginwidth = "0" marginheight = "0" leftMargin = "0" topMargin = "0" frameborder = "0" scrolling = "no"> </frame>
14. Move Javascript to the end of the HTML file
15. JS will block the display of the following page.
16. Use words as much as possible for friendship links.
17. optimized the image. GIF images are relatively small. They are generally used as logos, buttons, and expressions. PNG with many transparent backgrounds
18. Add a backslash (. www.maticsoft.com/220/) to the end of the website so that the server knows that the folder is located.
19. Specify the image size to make the browser clear.