Small summary of front-end optimization rules

Source: Internet
Author: User

(1) Minimize HTTP requests reduce HTTP requests

Minimize the number of images, CSS, Script, Flash, and so on, which can reduce the number of HTTP requests and thus reduce response time. Combine several JS, CSS files into a file, the page picture is written into CSS, and the page image is processed by CSS sprites technology.

(2) Make Ajax cacheable cache Ajax

In order to improve the response efficiency, the real-time response Ajax data is cached before the browser receives the new data.

(3) Post-load components delay loading component

When the page is initialized, load the necessary components first, and then load the other, Yui Get utility is a convenient way to include JS and CSS, Yui image loader can help to postpone loading the collapsed part of the picture.

(4) Preload components pre-loaded

When a user wants to access the next page, using preloaded page content (like, style sheets, and scripts) requested when the browser is idle can greatly improve access speed.

(5) Reduce the number of Dom Elements in the DOM element

Use labels reasonably and efficiently to structure pages, because complex page structures mean longer download and response times.

(6) Use a Content Delivery Network using CDN Technology

Content Delivery Network,cdn is made up of a series of Web servers dispersed across geographically diverse geographic locations that are specified primarily by the proximity of the user to the network, which improves the speed of website content transfer.

(7) Gzip Components gzip compression

Almost all browsers have the ability to unzip the gzip format, compressing the HTTP response with Gzip to reduce the file volume and save the HTTP response time, thereby increasing the user experience.

(8) using Get for AJAX requests Ajax request with Get method

The Get method interacts with the server only once (sending data), and the Post is two times (sending the header and then sending the data).

(9) Put stylesheets at the top CSS

Allow the browser to see the full style of the site as early as possible.

Make JavaScript and CSS External JS and css outside the chain

Because JavaScript and CSS files can generate caches in the browser, using external files in real-world applications can improve page speed.

Put Scripts at the Bottom put JS on the bottom

After the site has been rendered, the function settings, of course, these JS to your loading process does not affect the performance of the content.

Small summary of front-end optimization rules

Related Article

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.