How to optimize performance of web?
There are seven aspects of enhancing web pages loading performance
1. webpage content
- decrease the number of the http request
- decrease the number of the DNS-search
- avoid redirection problem
- avoid 404 error
- cache ajax request
- delay loading
- load beforehand
- decrease the number of DOM in the webpage content
- use different domain to load content
- decrease using the frame possibly
2. server
- use the CDN
- add the expires or cache-control into reponse-header
- use GZIP
- use Etag (this way can avoid 304)
- export cache quickly and early
- avoid the image's src is null
- use the get method of the ajax
3. cookie
- compress the size of cookie
- use domain with no-cookie of static resource
4. css
- the css should stay at the head tag
- don't use the expression of css
- use Link better than @important
- don't use filter?
- javascript
- the js file should stay at the body's ending
- compress the size of js file
- decrease the operation of the DOM
- don't use the repeated js file
- use more effective event
- picture
- use sprite
- optimize picture
- use favicon.ico
- don't scale picture in the structure of html
- mobile app
- keep every file's size is less than 25kb
- pack the webpage into multipart
reference
网友评论